graph
Interface Graph<V,E>

All Superinterfaces:
Iterable<Graph.Vertex<V,E>>
All Known Implementing Classes:
DiGraph

public interface Graph<V,E>
extends Iterable<Graph.Vertex<V,E>>

This interface represents a graph. It provides operations for building the graph, graph traverals and for marking/unmarking vertices. There are two nested interfaces representing vertices and edges in the graph.


Nested Class Summary
static interface Graph.Edge<V,E>
          Represents an edge in a graph.
static interface Graph.Vertex<V,E>
          Represents a vertex in a 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.
 void unvisit()
          Marks all vertices of this graph as not visited.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

addVertex

Graph.Vertex<V,E> addVertex(V value)
Inserts a new vertex in the graph.

Parameters:
value - The value associated with the newly inserted vertex.
Returns:
Returns the newly created vertex.

addEdge

void addEdge(E value,
             Graph.Vertex<V,E> source,
             Graph.Vertex<V,E> destination)
Inserts a new directed edge in this graph.

Parameters:
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.
Throws:
NoSuchElementException - if source or destination is not present in this graph.

unvisit

void unvisit()
Marks all vertices of this graph as not visited.