MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

graph/code13.cpp:110–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110int main()
111{
112 clock_t start = clock();
113
114 // int v = 6;
115 // vector<pair<int, int>> adj[v];
116
117 // // adding edges now
118 // add_edge(adj, 0, 1, 4);
119 // add_edge(adj, 0, 2, 2);
120 // add_edge(adj, 1, 3, 10);
121 // add_edge(adj, 1, 2, 5);
122 // add_edge(adj, 2, 4, 3);
123 // add_edge(adj, 4, 3, 4);
124 // add_edge(adj, 3, 5, 11);
125
126 // vector<int> sort_vec = topo_sort(adj, v);
127
128 // int source = 1;
129
130 // shortest_dist(adj, sort_vec, v, source);
131
132 int v = 4;
133 vector<pair<int, int>> adj[v];
134
135 // adding edges now
136 add_edge(adj, 0, 1, 15);
137 add_edge(adj, 0, 2, 2);
138 add_edge(adj, 2, 3, 3);
139 add_edge(adj, 3, 1, 4);
140
141 vector<int> sort_vec = topo_sort(adj, v);
142
143 int source = 0;
144
145 shortest_dist(adj, sort_vec, v, source);
146
147 clock_t end = clock();
148 double elapsed = double(end - start) / CLOCKS_PER_SEC;
149 // printf("Time measured: %.4f seconds.", elapsed);
150 return 0;
151}

Callers

nothing calls this directly

Calls 3

shortest_distFunction · 0.85
add_edgeFunction · 0.70
topo_sortFunction · 0.70

Tested by

no test coverage detected