added parts of main to push edge entry information to 2d vector relations
This commit is contained in:
parent
d855055e10
commit
b7caa92e39
1 changed files with 15 additions and 0 deletions
|
@ -45,6 +45,10 @@ int main() {
|
|||
|
||||
vector<vector<int>> relations;
|
||||
|
||||
for (int i = 0; i <= nodes; i++) {
|
||||
relations.push_back({ i });
|
||||
}
|
||||
|
||||
cout << "\nEnter the node connections in the format \"X-Y\" where\n"
|
||||
<< "X is the source node and Y is the destination node\n";
|
||||
cout << "Valid nodes range from 0 to " << nodes << " inclusive.\n"
|
||||
|
@ -58,6 +62,17 @@ int main() {
|
|||
stringstream ss(edgeInput);
|
||||
getline(ss, a, '-');
|
||||
getline(ss, b, '-');
|
||||
ss.str({});
|
||||
|
||||
try {
|
||||
relations[stoi(a)].push_back(stoi(b));
|
||||
}
|
||||
catch (...) {
|
||||
cout << "Invalid entry\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue