diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..67b1c9c --- /dev/null +++ b/main.cpp @@ -0,0 +1,36 @@ +#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("东安路")); + +} \ No newline at end of file