The following program finds out the hop count of the nodes in a connected network. Hop Count means the number of point to point connections in a graph of network. For example, in the graph shown below the hop count from node a to node b is one, node b to node c is two, etc.
This program assumes the graph given above.
usage: getHopCount(dictNeigh, node1,node2)
Where:
dictNeigh: dictionary of list of neighbor of each node in the network
node1 and node2 are the nodes for which hop count is calculated by the program
Exception: if the nodes are not connected then it returns Zero
Comments