Skip to content

Commit

Permalink
Fix the initial edges in graph_adjacency_matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
krahets committed Feb 9, 2023
1 parent 08b7474 commit b973c86
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion codes/go/chapter_graph/graph_adjacency_matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestGraphAdjMat(t *testing.T) {
/* 初始化无向图 */
// 请注意,edges 元素代表顶点索引,即对应 vertices 元素索引
vertices := []int{1, 3, 2, 5, 4}
edges := [][]int{{0, 1}, {0, 2}, {1, 2}, {2, 3}, {0, 3}, {2, 4}, {3, 4}}
edges := [][]int{{0, 1}, {1, 2}, {2, 3}, {0, 3}, {2, 4}, {3, 4}}
graph := newGraphAdjMat(vertices, edges)
fmt.Println("初始化后,图为:")
graph.print()
Expand Down
2 changes: 1 addition & 1 deletion codes/java/chapter_graph/graph_adjacency_matrix.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static void main(String[] args) {
/* 初始化无向图 */
// 请注意,edges 元素代表顶点索引,即对应 vertices 元素索引
int[] vertices = { 1, 3, 2, 5, 4 };
int[][] edges = { { 0, 1 }, { 0, 2 }, { 1, 2 }, { 2, 3 }, { 0, 3 }, { 2, 4 }, { 3, 4 } };
int[][] edges = { { 0, 1 }, { 1, 2 }, { 2, 3 }, { 0, 3 }, { 2, 4 }, { 3, 4 } };
GraphAdjMat graph = new GraphAdjMat(vertices, edges);
System.out.println("\n初始化后,图为");
graph.print();
Expand Down
2 changes: 1 addition & 1 deletion codes/swift/chapter_graph/graph_adjacency_matrix.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b973c86

Please sign in to comment.