Question: Question 6 : Graphs - Foraging for Rocks . . . . . . . . . . . . . . . . .

Question 6 : Graphs - Foraging for Rocks ..........................................10 points
Suppose that a node of our undirected graph G represents a clearing in a forest and an edge of our graph represents a trail between two clearings. For each node (i.e. clearing) we have a count of how many rocks are in that particular clearing.
In this problem, you're given an undirected graph G and a node S and you want to identify how many rocks can be reached by following paths from S to other clearings. For example suppose the graph below was your input graph G :
Examples: If your S was the node S1 above, you would find a total of 9 rocks (see the blue colored nodes). Similarly, if your S was the node S2 above, you would find that there were a total of 5 rocks. Finally, if your S was the node S3 above, you would find a total of 15 rocks.
We define a graph as follows:
Question 6 : Graphs - Foraging for Rocks . . . .

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 Programming Questions!