bug:connect函数在处理插入已存在连接时的业务逻辑错误
This commit is contained in:
+7
-1
@@ -20,10 +20,16 @@
|
||||
// 输入第1个4表示有4个顶点,第2个4表示有4条边。之后的4行输入代表4条边的顶点。
|
||||
// 输出的前4行为邻接矩阵,之后空一行,然后输出的“0 1 3 2”是深度优先遍历序列。
|
||||
|
||||
# include "Graph.h"
|
||||
#include"ListGraph.h"
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
ListGraph<int> list_graph;
|
||||
list_graph.insert(1);
|
||||
list_graph.insert(2);
|
||||
list_graph.connect(0,1);
|
||||
list_graph.connect(1,0);
|
||||
cout << list_graph.to_string() << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user