public class DirectedSparseMultigraph<V,E> extends AbstractTypedGraph<V,E> implements DirectedGraph<V,E>, MultiGraph<V,E>
DirectedGraph, suitable for sparse graphs,
that permits parallel edges.| Modifier and Type | Field and Description |
|---|---|
protected Map<E,Pair<V>> |
edges |
protected Map<V,Pair<Set<E>>> |
vertices |
edge_type| Constructor and Description |
|---|
DirectedSparseMultigraph()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addEdge(E edge,
Pair<? extends V> endpoints,
EdgeType edgeType)
Adds
edge to this graph with the specified endpoints
and EdgeType. |
boolean |
addVertex(V vertex) |
boolean |
containsEdge(E edge) |
boolean |
containsVertex(V vertex) |
E |
findEdge(V v1,
V v2) |
V |
getDest(E edge) |
int |
getEdgeCount() |
Collection<E> |
getEdges() |
Pair<V> |
getEndpoints(E edge) |
static <V,E> com.google.common.base.Supplier<DirectedGraph<V,E>> |
getFactory() |
Collection<E> |
getIncidentEdges(V vertex) |
protected Collection<E> |
getIncoming_internal(V vertex) |
Collection<E> |
getInEdges(V vertex) |
Collection<V> |
getNeighbors(V vertex) |
Collection<E> |
getOutEdges(V vertex) |
protected Collection<E> |
getOutgoing_internal(V vertex) |
Collection<V> |
getPredecessors(V vertex) |
V |
getSource(E edge) |
Collection<V> |
getSuccessors(V vertex) |
int |
getVertexCount() |
Collection<V> |
getVertices() |
boolean |
isDest(V vertex,
E edge) |
boolean |
isSource(V vertex,
E edge) |
boolean |
removeEdge(E edge) |
boolean |
removeVertex(V vertex) |
getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, hasEqualEdgeType, validateEdgeTypeaddEdge, addEdge, addEdge, addEdge, addEdge, degree, findEdgeSet, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, inDegree, isIncident, isNeighbor, isPredecessor, isSuccessor, outDegree, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddEdge, addEdge, getOpposite, getPredecessorCount, getSuccessorCount, inDegree, isPredecessor, isSuccessor, outDegreeaddEdge, addEdge, degree, findEdgeSet, getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, getIncidentCount, getIncidentVertices, getNeighborCount, isIncident, isNeighborpublic DirectedSparseMultigraph()
public static <V,E> com.google.common.base.Supplier<DirectedGraph<V,E>> getFactory()
V - the vertex type for the graph SupplierE - the edge type for the graph SupplierSupplier that creates an instance of this graph type.public Collection<E> getEdges()
getEdges in interface Hypergraph<V,E>public Collection<V> getVertices()
getVertices in interface Hypergraph<V,E>public boolean containsVertex(V vertex)
containsVertex in interface Hypergraph<V,E>public boolean containsEdge(E edge)
containsEdge in interface Hypergraph<V,E>protected Collection<E> getIncoming_internal(V vertex)
protected Collection<E> getOutgoing_internal(V vertex)
public boolean addVertex(V vertex)
addVertex in interface Hypergraph<V,E>public boolean removeVertex(V vertex)
removeVertex in interface Hypergraph<V,E>public boolean removeEdge(E edge)
removeEdge in interface Hypergraph<V,E>public Collection<E> getInEdges(V vertex)
getInEdges in interface Graph<V,E>getInEdges in interface Hypergraph<V,E>public Collection<E> getOutEdges(V vertex)
getOutEdges in interface Graph<V,E>getOutEdges in interface Hypergraph<V,E>public Collection<V> getPredecessors(V vertex)
getPredecessors in interface Graph<V,E>getPredecessors in interface Hypergraph<V,E>public Collection<V> getSuccessors(V vertex)
getSuccessors in interface Graph<V,E>getSuccessors in interface Hypergraph<V,E>public Collection<V> getNeighbors(V vertex)
getNeighbors in interface Hypergraph<V,E>public Collection<E> getIncidentEdges(V vertex)
getIncidentEdges in interface Hypergraph<V,E>public E findEdge(V v1, V v2)
findEdge in interface Hypergraph<V,E>findEdge in class AbstractGraph<V,E>public boolean addEdge(E edge, Pair<? extends V> endpoints, EdgeType edgeType)
AbstractGraphedge to this graph with the specified endpoints
and EdgeType.addEdge in class AbstractGraph<V,E>edge - the edge to be addedendpoints - the endpoints to be connected to this edgeedgeType - the type of edge to addpublic int getEdgeCount()
getEdgeCount in interface Hypergraph<V,E>public int getVertexCount()
getVertexCount in interface Hypergraph<V,E>Copyright © 2016. All rights reserved.