public class ObservableGraph<V,E> extends GraphDecorator<V,E>
delegate
Constructor and Description |
---|
ObservableGraph(Graph<V,E> delegate)
Creates a new instance based on the provided
delegate . |
Modifier and Type | Method and Description |
---|---|
boolean |
addEdge(E e,
V v1,
V v2)
Adds edge
e to this graph such that it connects
vertex v1 to v2 . |
boolean |
addEdge(E e,
V v1,
V v2,
EdgeType edgeType)
Adds edge
e to this graph such that it connects
vertex v1 to v2 . |
boolean |
addEdgeWithVertices(E edge,
java.util.Collection<? extends V> vertices)
Adds
edge to this graph. |
void |
addGraphEventListener(GraphEventListener<V,E> l)
Adds
l as a listener to this graph. |
boolean |
addVertex(V vertex)
Adds
vertex to this graph. |
protected void |
fireGraphEvent(GraphEvent<V,E> evt) |
boolean |
removeEdge(E edge)
Removes
edge from this graph. |
void |
removeGraphEventListener(GraphEventListener<V,E> l)
Removes
l as a listener to this graph. |
boolean |
removeVertex(V vertex)
Removes
vertex from this graph. |
addEdgeWithVertices, containsEdge, containsVertex, degree, findEdge, findEdgeSet, getDefaultEdgeType, getDest, getEdgeCount, getEdgeCount, getEdges, getEdgesView, getEdgeType, getEndpoints, getIncidentCount, getIncidentEdges, getIncidentVertices, getInEdges, getNeighborCount, getNeighbors, getOpposite, getOutEdges, getPredecessorCount, getPredecessors, getSource, getSuccessorCount, getSuccessors, getVertexCount, getVerticesView, inDegree, isDest, isIncident, isNeighbor, isPredecessor, isSource, isSuccessor, outDegree
public void addGraphEventListener(GraphEventListener<V,E> l)
l
as a listener to this graph.public void removeGraphEventListener(GraphEventListener<V,E> l)
l
as a listener to this graph.protected void fireGraphEvent(GraphEvent<V,E> evt)
public boolean addEdgeWithVertices(E edge, java.util.Collection<? extends V> vertices)
Hypergraph
edge
to this graph. Fails under the following circumstances:
edge
is already an element of the graphedge
or vertices
is null
vertices
has the wrong number of vertices for the graph typevertices
are already connected by another edge in this graph, and this graph does not accept parallel edgesaddEdgeWithVertices
in interface Hypergraph<V,E>
addEdgeWithVertices
in class GraphDecorator<V,E>
edge
- the edgevertices
- the verticestrue
if the add is successful, and false
otherwisepublic boolean addEdge(E e, V v1, V v2, EdgeType edgeType)
Graph
e
to this graph such that it connects
vertex v1
to v2
.
Equivalent to addEdge(e, new Pair(v1, v2))
.
If this graph does not contain v1
, v2
,
or both, implementations may choose to either silently add
the vertices to the graph or throw an IllegalArgumentException
.
If edgeType
is not legal for this graph, this method will
throw IllegalArgumentException
.
See Hypergraph.addEdge()
for a listing of possible reasons
for failure.addEdge
in interface Graph<V,E>
addEdge
in class GraphDecorator<V,E>
e
- the edge to be addedv1
- the first vertex to be connectedv2
- the second vertex to be connectededgeType
- the type to be assigned to the edgetrue
if the add is successful, false
otherwisepublic boolean addEdge(E e, V v1, V v2)
Graph
e
to this graph such that it connects
vertex v1
to v2
.
Equivalent to addEdge(e, new Pair(v1, v2))
.
If this graph does not contain v1
, v2
,
or both, implementations may choose to either silently add
the vertices to the graph or throw an IllegalArgumentException
.
If this graph assigns edge types to its edges, the edge type of
e
will be the default for this graph.
See Hypergraph.addEdge()
for a listing of possible reasons
for failure.addEdge
in interface Graph<V,E>
addEdge
in class GraphDecorator<V,E>
e
- the edge to be addedv1
- the first vertex to be connectedv2
- the second vertex to be connectedtrue
if the add is successful, false
otherwiseGraph.addEdge(Object, Object, Object, EdgeType)
public boolean addVertex(V vertex)
Hypergraph
vertex
to this graph. Fails if vertex
is null or already in the graph.addVertex
in interface Hypergraph<V,E>
addVertex
in class GraphDecorator<V,E>
vertex
- the vertex to addtrue
if the add is successful, and false
otherwisepublic boolean removeEdge(E edge)
Hypergraph
edge
from this graph.
Fails if edge
is null, or is otherwise not an element of this graph.removeEdge
in interface Hypergraph<V,E>
removeEdge
in class GraphDecorator<V,E>
edge
- the edge to removetrue
if the removal is successful, false
otherwisepublic boolean removeVertex(V vertex)
Hypergraph
vertex
from this graph. As a side effect, removes any edges e
incident to vertex
if the
removal of vertex
would cause e
to be incident to an illegal number of vertices. (Thus, for example,
incident hyperedges are not removed, but incident edges--which must be connected to a vertex at both endpoints--are removed.)
Fails under the following circumstances:
vertex
is not an element of this graphvertex
is null
removeVertex
in interface Hypergraph<V,E>
removeVertex
in class GraphDecorator<V,E>
vertex
- the vertex to removetrue
if the removal is successful, false
otherwiseCopyright © 2021, 2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence