0
/ 1.0
Description
Define a method boolean hasEdgeFromAToB(Graph g, int a, int b) that returns true if there is an edge from a to b. The object...
Define a method boolean hasEdgeFromAToB(Graph g, int a, int b) that returns true if there is an edge from a to b. The object g contains an undirected graph of type Graph. Graph implements the GraphADT interface (partially shown below); you must use the methods of GraphADT to access the information necessary to answer this question.
GraphADT interface is available online.We have included a partial definition of Graph here for your convenience.
public class Graph implements GraphADT<String> ...
{
// Is this graph a directed graph?
public boolean isDirected() {...}
// Return the number of nodes in this graph
public int getNodeCount() {...}
// Return the number of edges in the graph.
public int getEdgeCount() {...}
// Returns true iff the graph has the edge
// from v to w.
public boolean hasEdge(int v, int w) {...}
// Return the number of edges on node v.
public int getNodeDegree(int v) {...}
}
Your feedback will appear here when you check your answer.