Unweighted Graph Is Undirected
Create a public class
GraphAnalysis that provides a single
static method named
isUndirected accepts an
cs1.graphs and should return
true if the graph is
If the passed graph is
null, throw an
Each node in the graph has a set of neighbors that you can retrieve representing links from that node to other nodes. If the graph is undirected, if there is a link from A to B then there is also a link from B to A. So if B is a neighbor of A, then A should also be a neighbor of B.
Note that you do not need to solve this problem recursively, since there is a concise iterative solution.
cs1.graphs.UnweightedGraph has the following public properties:
cs1.graphs.GraphNode has the following public properties: