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

Function main

CPP/graphseries.cpp:562–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560
561
562int main()
563{
564 int n, m;
565 cin >> n >> m;
566
567 vector<int> arr[n + 1];
568 for (int i = 0; i < m; i++)
569 {
570 int x, y;
571 cin >> x >> y;
572 arr[x].push_back(y);
573 arr[y].push_back(x);
574 }
575 vector<int> ans;
576 int color[n + 1]; // for bipartite graph
577 memset(color, -1, sizeof(color)); // for bipartite graph
578 vector<int> vis(n + 1, 0);
579 for (int i = 1; i <= n; i++)
580 {
581 if (!vis[i])
582 {
583 if (cycleDFS(i, -1, vis, arr))
584 cout << true;
585 }
586 }
587
588 for (auto i : ans)
589 cout << i << " ";
590 return 0;
591}

Callers

nothing calls this directly

Calls 2

cycleDFSFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected