The following is a data set I have stored in a hash map, and I have to find the shortest path between two values.
9244, 4322, 4886, 5989, 8598, 9979, 1447, 9657
8598, 6752, 7146, 1951, 660, 1447, 7779
568, 1951, 4886, 2570, 9026, 9489, 7779
6752, 3424, 1977, 4746, 9657
77
The key value of the hash map is the first value of each line, the rest are the supposed "friends" of 9244 (same in each case).
i have saved in hash table in this format: hashmap(key, array)
, where:
- key is e.g. 9244
- array then holds [ 4322, 4886, 5989, 8598, 9979, 1447, 9657 ]
How to find shortest path between two keys?