Question: Modify DepthFirstPaths.java or BreadthFirstPaths.java to return the Wiener index of a graph. https://algs4.cs.princeton.edu/41graph/DepthFirstPaths.java.html https://algs4.cs.princeton.edu/41graph/BreadthFirstPaths.java.html Find the shortest path distance for each pair of vertices, and

Modify DepthFirstPaths.java or BreadthFirstPaths.java to return the Wiener index of a graph.

https://algs4.cs.princeton.edu/41graph/DepthFirstPaths.java.html

https://algs4.cs.princeton.edu/41graph/BreadthFirstPaths.java.html

Find the shortest path distance for each pair of vertices, and sum all the shortest paths.

Start with tinyCG.txt, an easy graph, which you can do by hand to check your algorithm.

Then generate the Wiener Index for Wiener.txt. Submit your .java program and the Wiener Index.

https://ufile.io/8hmji ----> Wiener.txt

https://ufile.io/y1dh8 -----> TinyCG.txt

The Wiener index of a vertex is the sum of the shortest path distances between v and all other vertices. The Wiener index of a graph G is the sum of the shortest path distances over all pairs of vertices.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!