Question: In a social network, a shortest path between two nodes is a path connecting the two nodes with the minimum number of edges in the
In a social network, a shortest path between two nodes is a path connecting the two nodes with the minimum number of edges in the network. An interesting problem is to find the number of shortest paths between two nodes of a social network. Given an undirected graph G(V,E), and two nodes v and w in G, design an algorithm that computes the number of shortest paths between v and w in G. (The algorithm should not list all the paths; just the number suffices.) The running time of your algorithm should be O(m + n) for a graph with n nodes and m edges.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
