Method Summary |
|
public void | addArc(String v, String w) Adds a directed edge between two nodes. |
public void | addVertex(String node) Adds a vertex to the adjacency list. |
public Object | clone() Clones the graph using a deep copy. |
public Iterator | getVertices() Provides an iterator over the vertices. |
public int | inDegree(String v) Counts the number of incoming arcs (edges) for a given node.
Parameters: v - is the vortex name to count incoming edge for. |
public boolean | isArc(String v, String w) Predicate to check the existence of a directed edge
between from v to w. |
public List | neighbors(String v) Determines the neighbors of a given node. |
public int | order() Counts the number of nodes (vertices) in a graph. |
public int | outDegree(String v) Counts the number of outgoing arcs (edges) for a given node.
Parameters: v - is the vortex name to count outgoing edge for. |
public void | removeArc(String v, String w) Removes a directed edge between two nodes. |
public void | removeVertex(String node) Removes a vortex from the graph. |
public Graph | reverseGraph() Constructs the reverse graph by inverting the direction of
every arc. |
public int | size() Counts the number of directed edges (arcs) in the graph.
Undirected edges are counted as two directed edges. |
public String | toString() Generates a simple string representation of the graph. |