mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 04:31:55 +08:00
feat: add the section of Graph Traversal (#367)
* Graph dev * Add the section of Graph Traversal. * Add missing Vertex.java * Add mkdocs.yml * Update numbering * Fix indentation and update array.md
This commit is contained in:
@ -100,7 +100,7 @@ public class graph_adjacency_matrix {
|
||||
/* 初始化无向图 */
|
||||
// 请注意,edges 元素代表顶点索引,即对应 vertices 元素索引
|
||||
int[] vertices = { 1, 3, 2, 5, 4 };
|
||||
int[][] edges = { { 0, 1 }, { 1, 2 }, { 2, 3 }, { 0, 3 }, { 2, 4 }, { 3, 4 } };
|
||||
int[][] edges = { { 0, 1 }, { 0, 3 }, { 1, 2 }, { 2, 3 }, { 2, 4 }, { 3, 4 } };
|
||||
GraphAdjMat graph = new GraphAdjMat(vertices, edges);
|
||||
System.out.println("\n初始化后,图为");
|
||||
graph.print();
|
||||
|
||||
Reference in New Issue
Block a user