AdjacencyMatrix
This commit is contained in:
27
Graph/adjacencyMatrix/graph.h
Normal file
27
Graph/adjacencyMatrix/graph.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include "vertexIterator.h"
|
||||
template <class T>
|
||||
struct edge {
|
||||
int from, to;
|
||||
T weight;
|
||||
|
||||
edge(int _from, int _to, T _weight) : from(_from), to(_to), weight(_weight) {}
|
||||
};
|
||||
template <class T>
|
||||
class Graph {
|
||||
public:
|
||||
virtual ~Graph() {}
|
||||
|
||||
//ADT Methods
|
||||
virtual int numberOfVertices() const = 0;
|
||||
virtual int numberOfEdges() const = 0;
|
||||
virtual bool existsEdge(int, int) const = 0;
|
||||
virtual void insertEdge(edge<T>*) = 0;
|
||||
virtual int degree(int) const = 0;
|
||||
virtual int inDegree(int) const = 0;
|
||||
|
||||
//Other Methods
|
||||
virtual bool directed() const = 0; //<2F><><EFBFBD><EFBFBD>ͼ
|
||||
virtual bool weighted() const = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩͼ
|
||||
virtual vertexIterator<T>* iterator(int) = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
Reference in New Issue
Block a user