![a graph contains vertices that are like points and edges that connect the points](img/abf9b1eff586dcbc635ccd0aedc5d1c0.png"Vertices and edges")
Vertices and edges
顶点和边
...
...
@@ -61,7 +61,7 @@ G = {V, E}
![graph adjacency matrix for sample graph shows that the value of matrix element is 1 for the row and column that have an edge and 0 for row and column that don't have an edge](img/770a8f4913ca61c9bbb1de31b7f97dad.png"Graph adjacency matrix")
Graph adjacency matrix
图邻接矩阵
...
...
@@ -79,7 +79,7 @@ Graph adjacency matrix
![adjacency list representation represents graph as array of linked lists where index represents the vertex and each element in linked list represents the edges connected to that vertex](img/a0cdb21344c49353e73743f80fe28594.png"Adjacency list representation")
![We start from vertex 0, the DFS algorithm starts by putting it in the Visited list and putting all its adjacent vertices in the stack.](img/adf56a84ca066b01a250844238d9df88.png"A DFS example")
Undirected graph with 5 vertices
具有 5 个顶点的无向图
...
...
@@ -40,7 +40,7 @@ Undirected graph with 5 vertices
![Start by putting it in the Visited list and putting all its adjacent vertices in the stack.](img/a0345cdcfcaae55af3a679216b92939b.png"A DFS example")
Visit the element and put it in the visited list
访问元素并将其放在访问列表中
...
...
@@ -48,7 +48,7 @@ Visit the element and put it in the visited list
![Next, we visit the element at the top of stack i.e. 1 and go to its adjacent nodes. Since 0 has already been visited, we visit 2 instead.](img/bd427d2a79ec03fd3bd4f19e3d443682.png"A DFS example")
Visit the element at the top of stack
访问栈顶部的元素
...
...
@@ -56,14 +56,13 @@ Visit the element at the top of stack
![Vertex 2 has an unvisited adjacent vertex in 4, so we add that to the top of the stack and visit it.](img/986235e87d99767348c456875b51c3fd.png"A DFS example")
Vertex 2 has an unvisited adjacent vertex in 4, so we add that to the top of the stack and visit it.
顶点 2 在 4 中有一个未访问的相邻顶点,因此我们将其添加到栈的顶部并对其进行访问。
![Vertex 2 has an unvisited adjacent vertex in 4, so we add that to the top of the stack and visit it.](img/dc1e07e6e8a87a5f90f6cd2177e9ed0a.png"A DFS example")
Vertex 2 has an unvisited adjacent vertex in 4, so we add that to the top of the stack and visit it.