Reindexing Values

  adjacency-matrix, c++, unordered-map

I am new to C++ programming and have an assignment where a file with a set of values is taken in and used to create an adjacency graph.
The .txt file is like so

1 3 22.5
3 1 22.5
8 5 14.2
3 5 2.5

The instructor is asking us to use an Unordered Map, but I don’t know how to use it for reindexing the first two int values (the float value is distance between the nodes). Can I iterate and fill the map with the values? If so, how?

expected results would be:

0 - 1
1 - 3
2 - 5
3 - 8

Any tips are much appreciated!

Source: Windows Questions C++

LEAVE A COMMENT