Question: Modify your Digraph class from the previous exercise to make a MultiDigraph class that allows parallel edges. For a test client, run a random- surfer
Modify your Digraph class from the previous exercise to make a MultiDigraph class that allows parallel edges. For a test client, run a random- surfer simulation that matches RandomSurfer (Program 1.6.2).
Data from in previous exercise
Implement a Digraph data type that represents directed graphs, where the direction of edges is significant: \(\operatorname{addEdge}(v, w)\) means to add an edge from \(v\) to \(w\) but not from \(w\) to \(v\). Replace adjacentTo () with two methods: one to give the set of vertices having edges directed to them from the argument vertex, and the other to give the set of vertices having edges directed from them to the argument vertex. Explain how PathFinder would need to be modified to find shortest paths in directed graphs.
Step by Step Solution
3.42 Rating (158 Votes )
There are 3 Steps involved in it
Dear student In Python a MultiDigraph is a type of directed graph that allows multiple parallel edges between the same pair of vertices This is differ... View full answer
Get step-by-step solutions from verified subject matter experts
