Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Write a function compute flow(g, dist, paths) that computes the flow across all of the edges using d and n from BFS Specifically, to

image text in transcribed
3. Write a function compute flow(g, dist, paths) that computes the flow across all of the edges using d and n from BFS Specifically, to compute the flow from node i in g. you would use your compute flow function as follows: dist, npaths bfs(g, i) low compute flow(g, dist, npaths) This function returns a dictionary in which the keys are frozensets with two elements that represent an edge in the graph and the values are the flow value for the corresponding edge. You should consider testing your function on the graph in Figure 3.20 of the book using source node A. (The graphs in the book are provided in bookgraphs. .) You should get the same results as in the figure. Failing to test this function is a bad idea, both in terms of your grade and in terms of your likely success on later problems. 4. Write a function, shortest_path_edge_ betweenness(g) that computes the shortest-path-based betweenness of all edges of graph g by summing, for each edge, the scores that the edge receives from all runs of compute flow (for every run of bfs from a different starting point, compute flow is run, thus producing for each edge n scores, if there are n nodes in the graph g). This function should return a dictionary in which the keys are frozensets with two elements that represent an edge in the graph and the values are the betweenness value for the corresponding edge This function should utilize your bfs and compute flow functions. Run it on the example in the appendix and ensure that your functions are working properly Report the results for the graph in Figure 3.20. Which edges have the highest betweenness? What does this imply about the graph

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2023 Workshops 34th International Conference Dexa 2023 Penang Malaysia August 28 30 2023 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Maqbool Khan

1st Edition

ISBN: 303139688X, 978-3031396885

Students also viewed these Databases questions

Question

9. Understand the phenomenon of code switching and interlanguage.

Answered: 1 week ago