public class Graph
extends java.lang.Object
Graph representation using the adjacency list form. See the book 'Introduction to Algorithms' by Cormen, Leiserson, and Rivest.
Constructor and Description |
---|
Graph() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(Edge edge)
Add an edge to the graph.
|
void |
addNode(java.lang.Object node)
Add a node to the graph.
|
void |
clear()
Clear the graph.
|
void |
clearTraversal()
Clear all nodes and edges of the bookkeeping information from their
last traversal.
|
boolean |
containsNode(java.lang.Object node)
Return true if the graph contains the given node.
|
java.util.Collection<Edge> |
getEdges()
Return all edges in the graph.
|
java.util.Collection<Edge> |
getEdges(java.lang.Object from,
java.lang.Object to)
Return all the edges from one node to another.
|
java.util.Collection<Edge> |
getEdgesFrom(java.lang.Object node)
Return all the edges from a particular node.
|
java.util.Collection<Edge> |
getEdgesTo(java.lang.Object node)
Return all the edges to a particular node.
|
java.util.Collection<java.lang.Object> |
getNodes()
Return a view of all nodes in the graph.
|
boolean |
removeEdge(Edge edge)
Remove an edge from the graph.
|
boolean |
removeNode(java.lang.Object node)
Remove a node from the graph.
|
public void clear()
public boolean containsNode(java.lang.Object node)
public java.util.Collection<java.lang.Object> getNodes()
public void addNode(java.lang.Object node)
public boolean removeNode(java.lang.Object node)
public java.util.Collection<Edge> getEdges()
public java.util.Collection<Edge> getEdgesFrom(java.lang.Object node)
public java.util.Collection<Edge> getEdgesTo(java.lang.Object node)
public java.util.Collection<Edge> getEdges(java.lang.Object from, java.lang.Object to)
public void addEdge(Edge edge)
public boolean removeEdge(Edge edge)
public void clearTraversal()
Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.