|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdigraph.DiGraph<V,E>
public class DiGraph<V,E>
Class DiGraph represents a generic directed graph with elements of type V associated to its vertices and data of type E to its Edges.
| Nested Class Summary | |
|---|---|
static class |
DiGraph.Edge<V,E>
Inner class representing an edge of a directed graph. |
static class |
DiGraph.Vertex<V,E>
Nested class representing a vertex of a directed graph. |
| Constructor Summary | |
|---|---|
DiGraph()
Constructs an empty directed graph |
|
| Method Summary | |
|---|---|
void |
addEdge(E value,
Graph.Vertex<V,E> source,
Graph.Vertex<V,E> destination)
Inserts a new directed edge in this graph. |
Graph.Vertex<V,E> |
addVertex(V value)
Inserts a new vertex in the graph. |
Iterator<Graph.Vertex<V,E>> |
iterator()
Creates an iterator for the vertices of this graph. |
String |
toString()
Returns a String representation of the vertices and edges of the graph. |
void |
unvisit()
Marks all vertices of this graph as not visited. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DiGraph()
| Method Detail |
|---|
public Iterator<Graph.Vertex<V,E>> iterator()
iterator in interface Iterable<Graph.Vertex<V,E>>public Graph.Vertex<V,E> addVertex(V value)
addVertex in interface Graph<V,E>value - The value associated with the newly inserted vertex.
public void addEdge(E value,
Graph.Vertex<V,E> source,
Graph.Vertex<V,E> destination)
addEdge in interface Graph<V,E>value - The value associated with the newly created edge.source - The source vertex of the newly created edge.destination - The destination vertex of the newly created Edge.
NoSuchElementException - if source or destination is not present in this graph.public void unvisit()
unvisit in interface Graph<V,E>public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||