跳转至

基础抽象类

class Graph
{
public:
    // 添加一条边(带权重的)
    virtual void addEdge(int from, int to, int weight) = 0;

    //删除一条边
    virtual void removeEdge(int from,int to) = 0;

    virtual bool hasEdge(int from,int to) = 0;

    virtual int weight(int from, int to) = 0;

    virtual std::vector<Edge> neighbors(int v)  = 0;

    //节点总数
    virtual int size() = 0;

    virtual ~Graph(){}

}