Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

10. A number of art museums around the country have been featuring work by an ar

ID: 3168376 • Letter: 1

Question

10. A number of art museums around the country have been featuring work by an artist named Mark Lombardi (1951-2000), consisting of a set of intricately rendered graphs. Building on a great deal of research, these graphs encode the relationships among people involved in major political scandals over the past several decades: the nodes correspond to partici- pants, and each edge indicates some type of relations hip between a pair of participants. And so, if you peer closely enough at the drawings, you can trace out ominous-looking paths from a high-ranking 0.S. govenm ment official, to a former business partner, to a bank in Switzerland, to a shadowy arms dealer Such pictures fom striking examples of social networks, which, as we discussed in Section 3.1, have nodes representing people and organi- zations, and edges representing relationships of various kinds. And the short paths that abound in these networks have attracted considerable attention recently, as people ponder what they mean. In the case of Mark Lombardi's graphs, they hint at the short set of steps that can carry you from the reputable to the disreputable. Exercises of course, a single, spurious short path between nodes v and w in such a network may be more coincidental thn anything else; a large number of short paths between v and w can be much more convincing. So in addition to the problem of computing a single shortest v-w path in a graph G, social networks researchers have looked at the problem of determining the number of shortest v-w paths. This turns out to be a problem that can be solved efficiently. Suppose we are given an undirected graph G= (V, E), and we identify two nodes v and w in G. Give an algorithm that computes the number of shortest v-w paths in G. (The algorithm should not list all the paths; just the number suffices.) The running time of your algorithm should be O(m ) for a graph with nodes and m edges.

Explanation / Answer

You can use counting variation of BFS.

we will use a dictionary.

At each iteration of the BFS, you track of the current depth of the path, and add the number of found paths to the next level.

Program--

this is psedo code for this problem.