#include #include using namespace std; #include "algraph.h" struct Station { string name; int line1; int line2; }; ALGraph G; int FindVertex(string name) { for (int i = 0; i < G.vexnum; i++) if (G.vexs[i].data.name == name) return i; return -1; // not found } int main() { InitGraph(G); AddVertex(G, Station{"肇嘉浜路", 1}); AddVertex(G, Station{"东安路", 1}); AddVertex(G, Station{"上海体育场", 1}); AddVertex(G, Station{"嘉善路", 1}); AddVertex(G, Station{"大木桥路", 1}); AddEdge(G, FindVertex("肇嘉浜路"), FindVertex("东安路")); }