bug:connect函数在处理插入已存在连接时的业务逻辑错误

This commit is contained in:
2024-12-05 15:24:28 +08:00
parent b0f712fa4a
commit 08f6f4b0f4
6 changed files with 206 additions and 85 deletions
+7 -1
View File
@@ -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;
}