scratch.joshua.jung_2_0.core
Class SimpleDirectedSparseGraph<V,E extends DirectedEdge>
java.lang.Object
scratch.joshua.jung_2_0.core.SimpleAbstractSparseGraph<V,E>
scratch.joshua.jung_2_0.core.SimpleDirectedSparseGraph<V,E>
- All Implemented Interfaces:
- ArchetypeGraph<V,E>, DirectedGraph<V,E>, Graph<V,E>
public class SimpleDirectedSparseGraph<V,E extends DirectedEdge>
- extends SimpleAbstractSparseGraph<V,E>
- implements DirectedGraph<V,E>
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 |
vertices
protected Map<V,Pair<Set<E extends DirectedEdge>>> vertices
edges
protected Map<E extends DirectedEdge,Pair<V>> edges
SimpleDirectedSparseGraph
public SimpleDirectedSparseGraph()
getEdges
public Collection getEdges()
- Specified by:
getEdges
in interface ArchetypeGraph<V,E extends DirectedEdge>
getVertices
public Collection getVertices()
- Specified by:
getVertices
in interface ArchetypeGraph<V,E extends DirectedEdge>
addVertex
public boolean addVertex(V vertex)
- Specified by:
addVertex
in interface ArchetypeGraph<V,E extends DirectedEdge>
removeVertex
public boolean removeVertex(V vertex)
- Specified by:
removeVertex
in interface ArchetypeGraph<V,E extends DirectedEdge>
removeEdge
public boolean removeEdge(E edge)
- Specified by:
removeEdge
in interface ArchetypeGraph<V,E extends DirectedEdge>
getInEdges
public Collection<E> getInEdges(V vertex)
- Specified by:
getInEdges
in interface Graph<V,E extends DirectedEdge>
getOutEdges
public Collection<E> getOutEdges(V vertex)
- Specified by:
getOutEdges
in interface Graph<V,E extends DirectedEdge>
getPredecessors
public Collection<V> getPredecessors(V vertex)
- Specified by:
getPredecessors
in interface Graph<V,E extends DirectedEdge>
getSuccessors
public Collection<V> getSuccessors(V vertex)
- Specified by:
getSuccessors
in interface Graph<V,E extends DirectedEdge>
getNeighbors
public Collection getNeighbors(V vertex)
- Specified by:
getNeighbors
in interface ArchetypeGraph<V,E extends DirectedEdge>
getIncidentEdges
public Collection getIncidentEdges(V vertex)
- Specified by:
getIncidentEdges
in interface ArchetypeGraph<V,E extends DirectedEdge>
findEdge
public E findEdge(V v1,
V v2)
- Specified by:
findEdge
in interface ArchetypeGraph<V,E extends DirectedEdge>
addDirectedEdge
public boolean addDirectedEdge(E edge,
V source,
V dest)
- Adds
edge
to the graph. Also adds
source
and dest
to the graph if they
are not already present. Returns false
if
the specified edge is
- Specified by:
addDirectedEdge
in interface DirectedGraph<V,E extends DirectedEdge>
getSource
public V getSource(E edge)
- Specified by:
getSource
in interface DirectedGraph<V,E extends DirectedEdge>
getDest
public V getDest(E edge)
- Specified by:
getDest
in interface DirectedGraph<V,E extends DirectedEdge>
isSource
public boolean isSource(V vertex,
E edge)
- Specified by:
isSource
in interface DirectedGraph<V,E extends DirectedEdge>
isDest
public boolean isDest(V vertex,
E edge)
- Specified by:
isDest
in interface DirectedGraph<V,E extends DirectedEdge>
getEndpoints
public Pair<V> getEndpoints(E edge)
- Specified by:
getEndpoints
in interface Graph<V,E extends DirectedEdge>