Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vector<set<int>> data;
- cout << "Список смежности графа:";
- for (i = 0; i < n + 1; i++)
- {
- set<int> temp;
- j = head[i];
- //if (i) cout << i << "->"; //if(i) -> если x не равно 0
- while (j > 0)
- {
- if (!next_el[j]) {
- for (int x : terminal[j]) {
- //cout << x << ", ";
- temp.insert(x);
- }
- } //(!next) -> если next = 0
- else {
- for (int x : terminal[j]) {
- //cout << x << ", ";
- temp.insert(x);
- }
- }
- j = next_el[j];
- }
- //cout << endl;
- data.push_back(move(temp));
- }
- int counter = 0;
- for (const auto& line : data) {
- if (counter) cout << counter << "->"; //if(counter) -> если counter не равно 0
- for (int x : line) {
- cout << x << " ";
- }
- cout << endl;
- counter++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement