grlist.h
来自「经典c++程序的实现」· C头文件 代码 · 共 35 行
H
35 行
class EdgeLink { // A singly-linked list node
public:
int weight; // Edge weight
int v1; // Vertex edge comes from
int v2; // Vertex edge goes to
EdgeLink* next; // Pointer to next edge in list
EdgeLink(int vt1, int vt2, int w, EdgeLink* nxt =NULL)
{ v1 = vt1; v2 = vt2; weight = w; next = nxt; } // Constructor
EdgeLink(EdgeLink* nxt =NULL) { next = nxt; } // Constructor
};
typedef EdgeLink* Edge;
class Graph { // Graph class: Adjacency list
public:
Edge* list; // The vertex list
int numVertex; // Number of vertices
int numEdge; // Number of edges
bool* Mark; // The mark array
Graph(); // Constructor
~Graph(); // Destructor
int n(); // Number of vertices for graph
int e(); // Number of edges for graph
Edge first(int); // Get the first edge for a vertex
bool isEdge(Edge); // TRUE if this is an edge
Edge next(Edge); // Get next edge for a vertex
int v1(Edge); // Return vertex edge comes from
int v2(Edge); // Return vertex edge goes to
int weight(int, int); // Return weight of edge
int weight(Edge); // Return weight of edge
};
bool createGraph(Graph&, FILE*);
void Gprint(Graph&);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?