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

Function topo_sort

graph/code12.cpp:15–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15void topo_sort(vector<int> vec[], vector<bool> &visited, int source, stack<int> &s)
16{
17 cout<<"source: "<<source<<endl;
18 visited[source] = true;
19 for (int i = 0; i < vec[source].size(); i++)
20 {
21 int adjacent = vec[source][i];
22 if (visited[adjacent] == false)
23 {
24 topo_sort(vec, visited, adjacent, s);
25 }
26 }
27 s.push(source);
28 return;
29}
30
31void topo_rec(vector<int> vec[], int v)
32{

Callers 1

topo_recFunction · 0.70

Calls 2

sizeMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected