graph.h

来自「数据结构与算法分析」· C头文件 代码 · 共 24 行

H
24
字号
// Graph abstract class
class Graph {
public:
  // Return the number of vertices
  virtual int n() =0;
  // Return the current number of edges
  virtual int e() =0;
  // Return the index of the first neigbor of given vertex
  virtual int first(int) =0;
  // Return the index of the next neigbor of given vertex
  virtual int next(int, int) =0;
  // Store an edge defined by two vertices and weight
  virtual void setEdge(int, int, int) =0;
  // Delete edge defined by two vertices
  virtual void delEdge(int, int) =0;
  // Return weight of edge connecting two vertices
  // Return 0 if no such edge exists
  virtual int weight(int, int) =0;
  // Get mark value for a vertex
  virtual int getMark(int) =0;
  //  Set mark value for a vertex
  virtual void setMark(int, int) =0;
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?