mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
Fix the initial edges in graph_adjacency_matrix
This commit is contained in:
@ -99,7 +99,7 @@ enum GraphAdjacencyMatrix {
|
||||
/* 初始化无向图 */
|
||||
// 请注意,edges 元素代表顶点索引,即对应 vertices 元素索引
|
||||
let vertices = [1, 3, 2, 5, 4]
|
||||
let edges = [[0, 1], [0, 2], [1, 2], [2, 3], [0, 3], [2, 4], [3, 4]]
|
||||
let edges = [[0, 1], [1, 2], [2, 3], [0, 3], [2, 4], [3, 4]]
|
||||
let graph = GraphAdjMat(vertices: vertices, edges: edges)
|
||||
print("\n初始化后,图为")
|
||||
graph.print()
|
||||
|
||||
Reference in New Issue
Block a user