public class OrderedSparseMultigraph<V,E> extends SparseMultigraph<V,E> implements MultiGraph<V,E>
Graph that orders its vertex and edge collections
according to insertion time, is suitable for sparse graphs, and
permits directed, undirected, and parallel edges.directedEdges, edges, vertices| Constructor and Description |
|---|
OrderedSparseMultigraph()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addVertex(V vertex)
Adds
vertex to this graph. |
static <V,E> Factory<Graph<V,E>> |
getFactory()
Returns a
Factory that creates an instance of this graph type. |
java.util.Collection<E> |
getIncidentEdges(V vertex)
Returns the collection of edges in this graph which are connected to
vertex. |
java.util.Collection<V> |
getNeighbors(V vertex)
Returns the collection of vertices which are connected to
vertex via any edges in this graph. |
java.util.Collection<V> |
getPredecessors(V vertex)
Returns a
Collection view of the predecessors of vertex
in this graph. |
java.util.Collection<V> |
getSuccessors(V vertex)
Returns a
Collection view of the successors of vertex
in this graph. |
addEdgeWithEndpoints, containsEdge, containsVertex, findEdge, getDefaultEdgeType, getDest, getEdgeCount, getEdgeCount, getEdges, getEdgesView, getEdgeType, getEndpoints, getIncoming_internal, getInEdges, getOutEdges, getOutgoing_internal, getSource, getVertexCount, getVerticesView, isDest, isSource, removeEdge, removeVertexaddEdge, addEdge, addEdgeWithEndPoints, addEdgeWithVertices, addEdgeWithVertices, degree, findEdgeSet, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, inDegree, isIncident, isNeighbor, isPredecessor, isSuccessor, outDegreepublic static <V,E> Factory<Graph<V,E>> getFactory()
Factory that creates an instance of this graph type.V - the vertex type for the graph factoryE - the edge type for the graph factorypublic boolean addVertex(V vertex)
Hypergraphvertex to this graph. Fails if vertex is null or already in the graph.addVertex in interface Hypergraph<V,E>addVertex in class SparseMultigraph<V,E>vertex - the vertex to addtrue if the add is successful, and false otherwisepublic java.util.Collection<V> getPredecessors(V vertex)
GraphCollection view of the predecessors of vertex
in this graph. A predecessor of vertex is defined as a vertex v
which is connected to
vertex by an edge e, where e is an outgoing edge of
v and an incoming edge of vertex.getPredecessors in interface Graph<V,E>getPredecessors in interface Hypergraph<V,E>getPredecessors in class SparseMultigraph<V,E>vertex - the vertex whose predecessors are to be returnedCollection view of the predecessors of
vertex in this graphpublic java.util.Collection<V> getSuccessors(V vertex)
GraphCollection view of the successors of vertex
in this graph. A successor of vertex is defined as a vertex v
which is connected to
vertex by an edge e, where e is an incoming edge of
v and an outgoing edge of vertex.getSuccessors in interface Graph<V,E>getSuccessors in interface Hypergraph<V,E>getSuccessors in class SparseMultigraph<V,E>vertex - the vertex whose predecessors are to be returnedCollection view of the successors of
vertex in this graphpublic java.util.Collection<V> getNeighbors(V vertex)
Hypergraphvertex via any edges in this graph.
If vertex is connected to itself with a self-loop, then it will be included in the collection returned.getNeighbors in interface Hypergraph<V,E>getNeighbors in class SparseMultigraph<V,E>vertex - the vertex whose neighbors are to be returnedvertex,
or null if vertex is not presentpublic java.util.Collection<E> getIncidentEdges(V vertex)
Hypergraphvertex.getIncidentEdges in interface Hypergraph<V,E>getIncidentEdges in class SparseMultigraph<V,E>vertex - the vertex whose incident edges are to be returnedvertex,
or null if vertex is not presentCopyright © 2021, 2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence