This script contains a simple graph and some useful functions
- BFS
- DFS
- TopologicalSort_indgree
- TopologicalSort_dfs
- Kruskal
- Prim
- Dijikstra
- Bellman-Ford
- Floyd
First,type in the vertices ,-1 for an end;
Then type in the edges in the format of vertice1 vertice2 cost line by line for an end;
then it will run the above functions.
Unfortunately I don't know how to tell the loop in the nonrecurse method of dfs ToplogicalSort.
If you have good ideas please contact me.