Undirected Graph Size
Create a method name
size that receives a reference to an unweighted graph containing
cs1.graphs.UnweightedGraph, so a
and returns the size of the graph as an
To complete this problem you'll need to implement graph traversal.
From a given node, you want to visit all of its neighbors except any nodes that you've already visited.
If you use a
Set to track the nodes that you've visited, then you can simply return the size of that
you are finished.
We've provided some starter code to get you off on the right track.
cs1.graphs.UnweightedGraph is declared somewhat like this:
cs1.graphs.GraphNode is declared somewhat like this: