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
+35
View File
@@ -0,0 +1,35 @@
//
// Created by 31416 on 24-12-5.
//
#ifndef MATRIXGRAPH_H
#define MATRIXGRAPH_H
#include<vector>
using namespace std;
template<typename T>
class MatrixGraph {
private:
vector<T> data;
vector<vector<bool> > matrix;
int nodeCount;
public:
MatrixGraph() {
matrix.clear();
data.clear();
nodeCount = 0;
}
void insert(T value) {
data.push_back(value);
nodeCount++;
matrix.push_back(vector<bool>(nodeCount, false));
for(int i = 0; i < nodeCount-1; ++i) {
matrix[i].push_back(false);
}
}
};
#endif //MATRIXGRAPH_H