org.apache.commons.graph.model
Class BaseGraph<V extends Vertex,E extends Edge<V>>

java.lang.Object
  extended by org.apache.commons.graph.model.BaseGraph<V,E>
Type Parameters:
V - the Graph vertices type
E - the Graph edges type
All Implemented Interfaces:
Graph<V,E>
Direct Known Subclasses:
BaseMutableGraph

public abstract class BaseGraph<V extends Vertex,E extends Edge<V>>
extends Object
implements Graph<V,E>

Basic abstract in-memory based of a simple read-only Graph implementation. Subclasses may load adjacency list/edges set in the constructor, or expose MutableGraph APIs.


Constructor Summary
BaseGraph()
           
 
Method Summary
protected  Map<V,Set<E>> getAdjacencyList()
          Returns the adjacency list where stored vertex/edges.
protected  Set<E> getAllEdges()
          Returns the set with all Graph edges.
 Set<E> getEdges()
          Returns the total set of Edges in the graph.
 Set<E> getEdges(V v)
          Returns all edges which touch this vertex, where the input vertex is in the edge head.
 Set<V> getVertices()
          Returns the total set of Vertices in the graph.
 Set<V> getVertices(E e)
          Return the set of Vertex on the input Edge (2 for normal edges, > 2 for HyperEdges)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseGraph

public BaseGraph()
Method Detail

getVertices

public final Set<V> getVertices()
Returns the total set of Vertices in the graph.

Specified by:
getVertices in interface Graph<V extends Vertex,E extends Edge<V>>
Returns:
the total set of Vertices in the graph.

getEdges

public final Set<E> getEdges()
Returns the total set of Edges in the graph.

Specified by:
getEdges in interface Graph<V extends Vertex,E extends Edge<V>>
Returns:
the total set of Edges in the graph.

getEdges

public final Set<E> getEdges(V v)
Returns all edges which touch this vertex, where the input vertex is in the edge head.

Specified by:
getEdges in interface Graph<V extends Vertex,E extends Edge<V>>
Returns:
all edges which touch this vertex, where the input vertex is in the edge head.

getVertices

public final Set<V> getVertices(E e)
Return the set of Vertex on the input Edge (2 for normal edges, > 2 for HyperEdges)

Specified by:
getVertices in interface Graph<V extends Vertex,E extends Edge<V>>
Returns:
the set of Vertex on this Edge.

getAdjacencyList

protected final Map<V,Set<E>> getAdjacencyList()
Returns the adjacency list where stored vertex/edges.

Returns:
the adjacency list where stored vertex/edges.

getAllEdges

protected final Set<E> getAllEdges()
Returns the set with all Graph edges.

Returns:
the set with all Graph edges.


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.