scratch.joshua.jung_2_0.core
Class SimpleUndirectedSparseGraph<V,E>

java.lang.Object
  extended by scratch.joshua.jung_2_0.core.SimpleAbstractSparseGraph<V,E>
      extended by scratch.joshua.jung_2_0.core.SimpleUndirectedSparseGraph<V,E>
All Implemented Interfaces:
ArchetypeGraph<V,E>, Graph<V,E>, UndirectedGraph<V,E>

public class SimpleUndirectedSparseGraph<V,E>
extends SimpleAbstractSparseGraph<V,E>
implements UndirectedGraph<V,E>


Field Summary
protected  Map<E,Pair<V>> edges
           
protected  Map<V,Set<E>> vertices
           
 
Constructor Summary
SimpleUndirectedSparseGraph()
           
 
Method Summary
 boolean addUndirectedEdge(E edge, V v1, V v2)
           
 boolean addVertex(V vertex)
           
 E findEdge(V v1, V v2)
           
 Collection<E> getEdges()
           
 Pair<V> getEndpoints(E edge)
           
 Collection<E> getIncidentEdges(V vertex)
           
 Collection<E> getInEdges(V vertex)
           
 Collection<V> getNeighbors(V vertex)
           
 Collection<E> getOutEdges(V vertex)
           
 Collection<V> getPredecessors(V vertex)
           
 Collection<V> getSuccessors(V vertex)
           
 Collection<V> getVertices()
           
 boolean removeEdge(E edge)
           
 boolean removeVertex(V vertex)
           
 
Methods inherited from class scratch.joshua.jung_2_0.core.SimpleAbstractSparseGraph
areIncident, areNeighbors, degree, getIncidentVertices, getOpposite, inDegree, isPredecessor, isSuccessor, numNeighbors, numPredecessors, numSuccessors, outDegree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface scratch.joshua.jung_2_0.core.Graph
getOpposite, inDegree, isPredecessor, isSuccessor, numPredecessors, numSuccessors, outDegree
 
Methods inherited from interface scratch.joshua.jung_2_0.core.ArchetypeGraph
areIncident, areNeighbors, degree, getIncidentVertices, numNeighbors
 

Field Detail

vertices

protected Map<V,Set<E>> vertices

edges

protected Map<E,Pair<V>> edges
Constructor Detail

SimpleUndirectedSparseGraph

public SimpleUndirectedSparseGraph()
Method Detail

getEdges

public Collection<E> getEdges()
Specified by:
getEdges in interface ArchetypeGraph<V,E>

getVertices

public Collection<V> getVertices()
Specified by:
getVertices in interface ArchetypeGraph<V,E>

addVertex

public boolean addVertex(V vertex)
Specified by:
addVertex in interface ArchetypeGraph<V,E>

removeVertex

public boolean removeVertex(V vertex)
Specified by:
removeVertex in interface ArchetypeGraph<V,E>

addUndirectedEdge

public boolean addUndirectedEdge(E edge,
                                 V v1,
                                 V v2)
Specified by:
addUndirectedEdge in interface UndirectedGraph<V,E>

removeEdge

public boolean removeEdge(E edge)
Specified by:
removeEdge in interface ArchetypeGraph<V,E>

getInEdges

public Collection<E> getInEdges(V vertex)
Specified by:
getInEdges in interface Graph<V,E>

getOutEdges

public Collection<E> getOutEdges(V vertex)
Specified by:
getOutEdges in interface Graph<V,E>

getPredecessors

public Collection<V> getPredecessors(V vertex)
Specified by:
getPredecessors in interface Graph<V,E>

getSuccessors

public Collection<V> getSuccessors(V vertex)
Specified by:
getSuccessors in interface Graph<V,E>

getNeighbors

public Collection<V> getNeighbors(V vertex)
Specified by:
getNeighbors in interface ArchetypeGraph<V,E>

getIncidentEdges

public Collection<E> getIncidentEdges(V vertex)
Specified by:
getIncidentEdges in interface ArchetypeGraph<V,E>

findEdge

public E findEdge(V v1,
                  V v2)
Specified by:
findEdge in interface ArchetypeGraph<V,E>

getEndpoints

public Pair<V> getEndpoints(E edge)
Specified by:
getEndpoints in interface Graph<V,E>