-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
95 lines (74 loc) · 2.23 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <stdio.h>
#include <stdlib.h>
#include "Includes/user.h"
void printMenu()
{
printf(" *** Options *** \n");
printf(" 1. Add Edge \n");
printf(" 2. Delete Edge \n");
printf(" 3. BFS Search \n");
printf(" 4. DFS Search \n");
printf(" 5. Topological Sorting \n");
printf(" 6. Eulerian Circuit (Fleury's Algorithm) \n");
printf(" 7. Graph Coloring (Welsh Powell's Algorithm) \n");
printf(" 8. Finding Connected Components (Tarjan's Algorithm) \n");
printf(" 9. Finding Minimum Spanning Tree (MST - Prim's Algorithm) \n");
printf("10 . Single Source Shortest Paths (Djikistra Algorithm / Bellman-Ford Algorithm)\n");
printf("11. All Pairs Shortest Paths (Floyd-Warshall Algorithm)\n");
printf(" 0. Exit Program \n\n\n");
printf("Choose one of the options above: ");
}
int main()
{
graph_t* graph = userCreateGraph();
int option;
do
{
printMenu();
scanf("%d", &option);
printf("\n");
switch (option)
{
case 1:
userGraphAddEdge(graph);
break;
case 2:
userGraphRemoveEdge(graph);
break;
case 3:
userGraphBFS(graph);
break;
case 4:
userGraphDFS(graph);
break;
case 5:
userTopologicalSorting(graph);
break;
case 6:
userGraphFindEulerianCycle(graph);
break;
case 7:
userGraphColoring(graph);
break;
case 8:
userFindConnectedComponents(graph);
break;
case 9:
userMinimumSpanningTree(graph);
break;
case 10:
userShortestPathSingleSource(graph);
break;
case 11:
userShortestPathAllSource(graph);
break;
case 0:
userExitProgram(&graph);
break;
default:
printf("Insert a valid option!\n");
break;
}
} while (option != 0);
return EXIT_SUCCESS;
}