Files
data-structures-and-algorithms/homework5/MatrixGraph.h
T

36 lines
618 B
C++

//
// 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