Advertisement
illfate

Untitled

Mar 31st, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. vector<set<int>> data;
  2. cout << "Список смежности графа:";
  3. for (i = 0; i < n + 1; i++)
  4. {
  5. set<int> temp;
  6. j = head[i];
  7. //if (i) cout << i << "->"; //if(i) -> если x не равно 0
  8. while (j > 0)
  9. {
  10. if (!next_el[j]) {
  11. for (int x : terminal[j]) {
  12. //cout << x << ", ";
  13. temp.insert(x);
  14. }
  15. } //(!next) -> если next = 0
  16. else {
  17. for (int x : terminal[j]) {
  18. //cout << x << ", ";
  19. temp.insert(x);
  20. }
  21. }
  22. j = next_el[j];
  23. }
  24. //cout << endl;
  25. data.push_back(move(temp));
  26. }
  27. int counter = 0;
  28. for (const auto& line : data) {
  29. if (counter) cout << counter << "->"; //if(counter) -> если counter не равно 0
  30. for (int x : line) {
  31. cout << x << " ";
  32. }
  33. cout << endl;
  34. counter++;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement