Breadth First Search: Shortest Reach

  • + 2 comments

    Absolutely it is. And further this means, if you are using an adjacency list to find sibling nodes, then looking up some node x and finding y in the adjacency list, means you should also be able to look up node y and find x somewhere in its adjacency list. E.g.

    adjList[x] => [ ?, ?, ?, y, ?, ... ] 
    

    Implies:

    adjList[y] => [ ?, x, ?, ?, ?, ... ] 
    

    But the input data set does not explicity reflect that, so you need to ensure that you map both ways for any given edge. This caused me some debugging to figure out.