edu.uci.ics.jung.graph
Class GraphDecorator<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.graph.GraphDecorator<V,E>
All Implemented Interfaces:
Graph<V,E>, Hypergraph<V,E>
Direct Known Subclasses:
DelegateForest, DelegateTree, ObservableGraph

public class GraphDecorator<V,E>
extends Object
implements Graph<V,E>

An implementation of Graph that delegates its method calls to a constructor-specified Graph instance. This is useful for adding additional behavior (such as synchronization or unmodifiability) to an existing instance.


Field Summary
protected  Graph<V,E> delegate
           
 
Constructor Summary
GraphDecorator(Graph<V,E> delegate)
          Creates a new instance based on the provided delegate.
 
Method Summary
 boolean addEdge(E edge, Collection<? extends V> vertices)
          Adds edge to this graph.
 boolean addEdge(E edge, Collection<? extends V> vertices, EdgeType edge_type)
          Adds edge to this graph with type edge_type.
 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 addVertex(V vertex)
          Adds vertex to this graph.
 boolean containsEdge(E edge)
          Returns true if this graph's edge collection contains edge.
 boolean containsVertex(V vertex)
          Returns true if this graph's vertex collection contains vertex.
 int degree(V vertex)
          Returns the number of edges incident to vertex.
 E findEdge(V v1, V v2)
          Returns an edge that connects this vertex to v.
 Collection<E> findEdgeSet(V v1, V v2)
          Returns all edges that connects this vertex to v.
 EdgeType getDefaultEdgeType()
          Returns the default edge type for this graph.
 V getDest(E directed_edge)
          If directed_edge is a directed edge in this graph, returns the destination; otherwise returns null.
 int getEdgeCount()
          Returns the number of edges in this graph.
 int getEdgeCount(EdgeType edge_type)
          Returns the number of edges of type edge_type in this graph.
 Collection<E> getEdges()
          Returns a view of all edges in this graph.
 Collection<E> getEdges(EdgeType edgeType)
          Returns the collection of edges in this graph which are of type edge_type.
 EdgeType getEdgeType(E edge)
          Returns the edge type of edge in this graph.
 Pair<V> getEndpoints(E edge)
          Returns the endpoints of edge as a Pair.
 int getIncidentCount(E edge)
          Returns the number of vertices that are incident to edge.
 Collection<E> getIncidentEdges(V vertex)
          Returns the collection of edges in this graph which are connected to vertex.
 Collection<V> getIncidentVertices(E edge)
          Returns the collection of vertices in this graph which are connected to edge.
 Collection<E> getInEdges(V vertex)
          Returns a Collection view of the incoming edges incident to vertex in this graph.
 int getNeighborCount(V vertex)
          Returns the number of vertices that are adjacent to vertex (that is, the number of vertices that are incident to edges in vertex's incident edge set).
 Collection<V> getNeighbors(V vertex)
          Returns the collection of vertices which are connected to vertex via any edges in this graph.
 V getOpposite(V vertex, E edge)
          Returns the vertex at the other end of edge from vertex.
 Collection<E> getOutEdges(V vertex)
          Returns a Collection view of the outgoing edges incident to vertex in this graph.
 int getPredecessorCount(V vertex)
          Returns the number of predecessors that vertex has in this graph.
 Collection<V> getPredecessors(V vertex)
          Returns a Collection view of the predecessors of vertex in this graph.
 V getSource(E directed_edge)
          If directed_edge is a directed edge in this graph, returns the source; otherwise returns null.
 int getSuccessorCount(V vertex)
          Returns the number of successors that vertex has in this graph.
 Collection<V> getSuccessors(V vertex)
          Returns a Collection view of the successors of vertex in this graph.
 int getVertexCount()
          Returns the number of vertices in this graph.
 Collection<V> getVertices()
          Returns a view of all vertices in this graph.
 int inDegree(V vertex)
          Returns the number of incoming edges incident to vertex.
 boolean isDest(V vertex, E edge)
          Returns true if vertex is the destination of edge.
 boolean isIncident(V vertex, E edge)
          Returns true if vertex and edge are incident to each other.
 boolean isNeighbor(V v1, V v2)
          Returns true if v1 and v2 share an incident edge.
 boolean isPredecessor(V v1, V v2)
          Returns true if v1 is a predecessor of v2 in this graph.
 boolean isSource(V vertex, E edge)
          Returns true if vertex is the source of edge.
 boolean isSuccessor(V v1, V v2)
          Returns true if v1 is a successor of v2 in this graph.
 int outDegree(V vertex)
          Returns the number of outgoing edges incident to vertex.
 boolean removeEdge(E edge)
          Removes edge from this graph.
 boolean removeVertex(V vertex)
          Removes vertex from this graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected Graph<V,E> delegate
Constructor Detail

GraphDecorator

public GraphDecorator(Graph<V,E> delegate)
Creates a new instance based on the provided delegate.

Parameters:
delegate -
Method Detail

addEdge

public boolean addEdge(E edge,
                       Collection<? extends V> vertices)
Description copied from interface: Hypergraph
Adds edge to this graph. Fails under the following circumstances:

Specified by:
addEdge in interface Hypergraph<V,E>
Returns:
true if the add is successful, and false otherwise
See Also:
Hypergraph.addEdge(java.lang.Object, java.util.Collection)

addEdge

public boolean addEdge(E edge,
                       Collection<? extends V> vertices,
                       EdgeType edge_type)
Description copied from interface: Hypergraph
Adds edge to this graph with type edge_type. Fails under the following circumstances:

Specified by:
addEdge in interface Hypergraph<V,E>
Returns:
true if the add is successful, and false otherwise
See Also:
Hypergraph.addEdge(Object, Collection, EdgeType)

addEdge

public boolean addEdge(E e,
                       V v1,
                       V v2,
                       EdgeType edgeType)
Description copied from interface: Graph
Adds edge 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.

Specified by:
addEdge in interface Graph<V,E>
Parameters:
e - the edge to be added
v1 - the first vertex to be connected
v2 - the second vertex to be connected
edgeType - the type to be assigned to the edge
Returns:
true if the add is successful, false otherwise
See Also:
Graph.addEdge(java.lang.Object, java.lang.Object, java.lang.Object, edu.uci.ics.jung.graph.util.EdgeType)

addEdge

public boolean addEdge(E e,
                       V v1,
                       V v2)
Description copied from interface: Graph
Adds edge 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.

Specified by:
addEdge in interface Graph<V,E>
Parameters:
e - the edge to be added
v1 - the first vertex to be connected
v2 - the second vertex to be connected
Returns:
true if the add is successful, false otherwise
See Also:
Graph.addEdge(java.lang.Object, java.lang.Object, java.lang.Object)

addVertex

public boolean addVertex(V vertex)
Description copied from interface: Hypergraph
Adds vertex to this graph. Fails if vertex is null or already in the graph.

Specified by:
addVertex in interface Hypergraph<V,E>
Parameters:
vertex - the vertex to add
Returns:
true if the add is successful, and false otherwise
See Also:
Hypergraph.addVertex(java.lang.Object)

isIncident

public boolean isIncident(V vertex,
                          E edge)
Description copied from interface: Hypergraph
Returns true if vertex and edge are incident to each other. Equivalent to getIncidentEdges(vertex).contains(edge) and to getIncidentVertices(edge).contains(vertex).

Specified by:
isIncident in interface Hypergraph<V,E>
Returns:
true if vertex and edge are incident to each other
See Also:
Hypergraph.isIncident(java.lang.Object, java.lang.Object)

isNeighbor

public boolean isNeighbor(V v1,
                          V v2)
Description copied from interface: Hypergraph
Returns true if v1 and v2 share an incident edge. Equivalent to getNeighbors(v1).contains(v2).

Specified by:
isNeighbor in interface Hypergraph<V,E>
Parameters:
v1 - the first vertex to test
v2 - the second vertex to test
Returns:
true if v1 and v2 share an incident edge
See Also:
Hypergraph.isNeighbor(java.lang.Object, java.lang.Object)

degree

public int degree(V vertex)
Description copied from interface: Hypergraph
Returns the number of edges incident to vertex. Special cases of interest:

Equivalent to getIncidentEdges(vertex).size().

Specified by:
degree in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose degree is to be returned
Returns:
the degree of this node
See Also:
Hypergraph.degree(java.lang.Object)

findEdge

public E findEdge(V v1,
                  V v2)
Description copied from interface: Hypergraph
Returns an edge that connects this vertex to v. If this edge is not uniquely defined (that is, if the graph contains more than one edge connecting v1 to v2), any of these edges may be returned. findEdgeSet(v1, v2) may be used to return all such edges. Returns null if either of the following is true:

Note: for purposes of this method, v1 is only considered to be connected to v2 via a given directed edge e if v1 == e.getSource() && v2 == e.getDest() evaluates to true. (v1 and v2 are connected by an undirected edge u if u is incident to both v1 and v2.)

Specified by:
findEdge in interface Hypergraph<V,E>
Returns:
an edge that connects v1 to v2, or null if no such edge exists (or either vertex is not present)
See Also:
Hypergraph.findEdge(java.lang.Object, java.lang.Object)

findEdgeSet

public Collection<E> findEdgeSet(V v1,
                                 V v2)
Description copied from interface: Hypergraph
Returns all edges that connects this vertex to v. If this edge is not uniquely defined (that is, if the graph contains more than one edge connecting v1 to v2), any of these edges may be returned. findEdgeSet(v1, v2) may be used to return all such edges. Returns null if v2 is not connected to v1.
Returns an empty collection if either v1 or v2 are not present in this graph.

Note: for purposes of this method, v1 is only considered to be connected to v2 via a given directed edge d if v1 == d.getSource() && v2 == d.getDest() evaluates to true. (v1 and v2 are connected by an undirected edge u if u is incident to both v1 and v2.)

Specified by:
findEdgeSet in interface Hypergraph<V,E>
Returns:
a collection containing all edges that connect v1 to v2, or null if either vertex is not present
See Also:
Hypergraph.findEdgeSet(java.lang.Object, java.lang.Object)

getDest

public V getDest(E directed_edge)
Description copied from interface: Graph
If directed_edge is a directed edge in this graph, returns the destination; otherwise returns null. The destination of a directed edge d is defined to be the vertex incident to d for which d is an incoming edge. directed_edge is guaranteed to be a directed edge if its EdgeType is DIRECTED.

Specified by:
getDest in interface Graph<V,E>
Specified by:
getDest in interface Hypergraph<V,E>
Returns:
the destination of directed_edge if it is a directed edge in this graph, or null otherwise
See Also:
Graph.getDest(java.lang.Object)

getEdgeCount

public int getEdgeCount()
Description copied from interface: Hypergraph
Returns the number of edges in this graph.

Specified by:
getEdgeCount in interface Hypergraph<V,E>
Returns:
the number of edges in this graph
See Also:
Hypergraph.getEdgeCount()

getEdgeCount

public int getEdgeCount(EdgeType edge_type)
Description copied from interface: Hypergraph
Returns the number of edges of type edge_type in this graph.

Specified by:
getEdgeCount in interface Hypergraph<V,E>
Parameters:
edge_type - the type of edge for which the count is to be returned
Returns:
the number of edges of type edge_type in this graph
See Also:
Hypergraph.getEdgeCount(EdgeType)

getEdges

public Collection<E> getEdges()
Description copied from interface: Hypergraph
Returns a view of all edges in this graph. In general, this obeys the Collection contract, and therefore makes no guarantees about the ordering of the vertices within the set.

Specified by:
getEdges in interface Hypergraph<V,E>
Returns:
a Collection view of all edges in this graph
See Also:
Hypergraph.getEdges()

getEdges

public Collection<E> getEdges(EdgeType edgeType)
Description copied from interface: Hypergraph
Returns the collection of edges in this graph which are of type edge_type.

Specified by:
getEdges in interface Hypergraph<V,E>
Parameters:
edgeType - the type of edges to be returned
Returns:
the collection of edges which are of type edge_type, or null if the graph does not accept edges of this type
See Also:
Hypergraph.getEdges(edu.uci.ics.jung.graph.util.EdgeType)

getEdgeType

public EdgeType getEdgeType(E edge)
Description copied from interface: Hypergraph
Returns the edge type of edge in this graph.

Specified by:
getEdgeType in interface Hypergraph<V,E>
Returns:
the EdgeType of edge, or null if edge has no defined type
See Also:
Hypergraph.getEdgeType(java.lang.Object)

getDefaultEdgeType

public EdgeType getDefaultEdgeType()
Description copied from interface: Hypergraph
Returns the default edge type for this graph.

Specified by:
getDefaultEdgeType in interface Hypergraph<V,E>
Returns:
the default edge type for this graph
See Also:
Hypergraph.getDefaultEdgeType()

getEndpoints

public Pair<V> getEndpoints(E edge)
Description copied from interface: Graph
Returns the endpoints of edge as a Pair.

Specified by:
getEndpoints in interface Graph<V,E>
Parameters:
edge - the edge whose endpoints are to be returned
Returns:
the endpoints (incident vertices) of edge
See Also:
Graph.getEndpoints(java.lang.Object)

getIncidentCount

public int getIncidentCount(E edge)
Description copied from interface: Hypergraph
Returns the number of vertices that are incident to edge. For hyperedges, this can be any nonnegative integer; for edges this must be 2 (or 1 if self-loops are permitted).

Equivalent to getIncidentVertices(edge).size().

Specified by:
getIncidentCount in interface Hypergraph<V,E>
Parameters:
edge - the edge whose incident vertex count is to be returned
Returns:
the number of vertices that are incident to edge.
See Also:
Hypergraph.getIncidentCount(java.lang.Object)

getIncidentEdges

public Collection<E> getIncidentEdges(V vertex)
Description copied from interface: Hypergraph
Returns the collection of edges in this graph which are connected to vertex.

Specified by:
getIncidentEdges in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose incident edges are to be returned
Returns:
the collection of edges which are connected to vertex, or null if vertex is not present
See Also:
Hypergraph.getIncidentEdges(java.lang.Object)

getIncidentVertices

public Collection<V> getIncidentVertices(E edge)
Description copied from interface: Hypergraph
Returns the collection of vertices in this graph which are connected to edge. Note that for some graph types there are guarantees about the size of this collection (i.e., some graphs contain edges that have exactly two endpoints, which may or may not be distinct). Implementations for those graph types may provide alternate methods that provide more convenient access to the vertices.

Specified by:
getIncidentVertices in interface Hypergraph<V,E>
Parameters:
edge - the edge whose incident vertices are to be returned
Returns:
the collection of vertices which are connected to edge, or null if edge is not present
See Also:
Hypergraph.getIncidentVertices(java.lang.Object)

getInEdges

public Collection<E> getInEdges(V vertex)
Description copied from interface: Graph
Returns a Collection view of the incoming edges incident to vertex in this graph.

Specified by:
getInEdges in interface Graph<V,E>
Specified by:
getInEdges in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose incoming edges are to be returned
Returns:
a Collection view of the incoming edges incident to vertex in this graph
See Also:
Graph.getInEdges(java.lang.Object)

getNeighborCount

public int getNeighborCount(V vertex)
Description copied from interface: Hypergraph
Returns the number of vertices that are adjacent to vertex (that is, the number of vertices that are incident to edges in vertex's incident edge set).

Equivalent to getNeighbors(vertex).size().

Specified by:
getNeighborCount in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose neighbor count is to be returned
Returns:
the number of neighboring vertices
See Also:
Hypergraph.getNeighborCount(java.lang.Object)

getNeighbors

public Collection<V> getNeighbors(V vertex)
Description copied from interface: Hypergraph
Returns the collection of vertices which are connected to vertex 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.

Specified by:
getNeighbors in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose neighbors are to be returned
Returns:
the collection of vertices which are connected to vertex, or null if vertex is not present
See Also:
Hypergraph.getNeighbors(java.lang.Object)

getOpposite

public V getOpposite(V vertex,
                     E edge)
Description copied from interface: Graph
Returns the vertex at the other end of edge from vertex. (That is, returns the vertex incident to edge which is not vertex.)

Specified by:
getOpposite in interface Graph<V,E>
Parameters:
vertex - the vertex to be queried
edge - the edge to be queried
Returns:
the vertex at the other end of edge from vertex
See Also:
Graph.getOpposite(java.lang.Object, java.lang.Object)

getOutEdges

public Collection<E> getOutEdges(V vertex)
Description copied from interface: Graph
Returns a Collection view of the outgoing edges incident to vertex in this graph.

Specified by:
getOutEdges in interface Graph<V,E>
Specified by:
getOutEdges in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose outgoing edges are to be returned
Returns:
a Collection view of the outgoing edges incident to vertex in this graph
See Also:
Graph.getOutEdges(java.lang.Object)

getPredecessorCount

public int getPredecessorCount(V vertex)
Description copied from interface: Graph
Returns the number of predecessors that vertex has in this graph. Equivalent to vertex.getPredecessors().size().

Specified by:
getPredecessorCount in interface Graph<V,E>
Parameters:
vertex - the vertex whose predecessor count is to be returned
Returns:
the number of predecessors that vertex has in this graph
See Also:
Graph.getPredecessorCount(java.lang.Object)

getPredecessors

public Collection<V> getPredecessors(V vertex)
Description copied from interface: Graph
Returns a Collection 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.

Specified by:
getPredecessors in interface Graph<V,E>
Specified by:
getPredecessors in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose predecessors are to be returned
Returns:
a Collection view of the predecessors of vertex in this graph
See Also:
Graph.getPredecessors(java.lang.Object)

getSource

public V getSource(E directed_edge)
Description copied from interface: Graph
If directed_edge is a directed edge in this graph, returns the source; otherwise returns null. The source of a directed edge d is defined to be the vertex for which d is an outgoing edge. directed_edge is guaranteed to be a directed edge if its EdgeType is DIRECTED.

Specified by:
getSource in interface Graph<V,E>
Specified by:
getSource in interface Hypergraph<V,E>
Returns:
the source of directed_edge if it is a directed edge in this graph, or null otherwise
See Also:
Graph.getSource(java.lang.Object)

getSuccessorCount

public int getSuccessorCount(V vertex)
Description copied from interface: Graph
Returns the number of successors that vertex has in this graph. Equivalent to vertex.getSuccessors().size().

Specified by:
getSuccessorCount in interface Graph<V,E>
Parameters:
vertex - the vertex whose successor count is to be returned
Returns:
the number of successors that vertex has in this graph
See Also:
Graph.getSuccessorCount(java.lang.Object)

getSuccessors

public Collection<V> getSuccessors(V vertex)
Description copied from interface: Graph
Returns a Collection 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.

Specified by:
getSuccessors in interface Graph<V,E>
Specified by:
getSuccessors in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose predecessors are to be returned
Returns:
a Collection view of the successors of vertex in this graph
See Also:
Graph.getSuccessors(java.lang.Object)

getVertexCount

public int getVertexCount()
Description copied from interface: Hypergraph
Returns the number of vertices in this graph.

Specified by:
getVertexCount in interface Hypergraph<V,E>
Returns:
the number of vertices in this graph
See Also:
Hypergraph.getVertexCount()

getVertices

public Collection<V> getVertices()
Description copied from interface: Hypergraph
Returns a view of all vertices in this graph. In general, this obeys the Collection contract, and therefore makes no guarantees about the ordering of the vertices within the set.

Specified by:
getVertices in interface Hypergraph<V,E>
Returns:
a Collection view of all vertices in this graph
See Also:
Hypergraph.getVertices()

inDegree

public int inDegree(V vertex)
Description copied from interface: Graph
Returns the number of incoming edges incident to vertex. Equivalent to getInEdges(vertex).size().

Specified by:
inDegree in interface Graph<V,E>
Specified by:
inDegree in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose indegree is to be calculated
Returns:
the number of incoming edges incident to vertex
See Also:
Graph.inDegree(java.lang.Object)

isDest

public boolean isDest(V vertex,
                      E edge)
Description copied from interface: Graph
Returns true if vertex is the destination of edge. Equivalent to getDest(edge).equals(vertex).

Specified by:
isDest in interface Graph<V,E>
Parameters:
vertex - the vertex to be queried
edge - the edge to be queried
Returns:
true iff vertex is the destination of edge
See Also:
Graph.isDest(java.lang.Object, java.lang.Object)

isPredecessor

public boolean isPredecessor(V v1,
                             V v2)
Description copied from interface: Graph
Returns true if v1 is a predecessor of v2 in this graph. Equivalent to v1.getPredecessors().contains(v2).

Specified by:
isPredecessor in interface Graph<V,E>
Parameters:
v1 - the first vertex to be queried
v2 - the second vertex to be queried
Returns:
true if v1 is a predecessor of v2, and false otherwise.
See Also:
Graph.isPredecessor(java.lang.Object, java.lang.Object)

isSource

public boolean isSource(V vertex,
                        E edge)
Description copied from interface: Graph
Returns true if vertex is the source of edge. Equivalent to getSource(edge).equals(vertex).

Specified by:
isSource in interface Graph<V,E>
Parameters:
vertex - the vertex to be queried
edge - the edge to be queried
Returns:
true iff vertex is the source of edge
See Also:
Graph.isSource(java.lang.Object, java.lang.Object)

isSuccessor

public boolean isSuccessor(V v1,
                           V v2)
Description copied from interface: Graph
Returns true if v1 is a successor of v2 in this graph. Equivalent to v1.getSuccessors().contains(v2).

Specified by:
isSuccessor in interface Graph<V,E>
Parameters:
v1 - the first vertex to be queried
v2 - the second vertex to be queried
Returns:
true if v1 is a successor of v2, and false otherwise.
See Also:
Graph.isSuccessor(java.lang.Object, java.lang.Object)

outDegree

public int outDegree(V vertex)
Description copied from interface: Graph
Returns the number of outgoing edges incident to vertex. Equivalent to getOutEdges(vertex).size().

Specified by:
outDegree in interface Graph<V,E>
Specified by:
outDegree in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose outdegree is to be calculated
Returns:
the number of outgoing edges incident to vertex
See Also:
Graph.outDegree(java.lang.Object)

removeEdge

public boolean removeEdge(E edge)
Description copied from interface: Hypergraph
Removes edge from this graph. Fails if edge is null, or is otherwise not an element of this graph.

Specified by:
removeEdge in interface Hypergraph<V,E>
Parameters:
edge - the edge to remove
Returns:
true if the removal is successful, false otherwise
See Also:
Hypergraph.removeEdge(java.lang.Object)

removeVertex

public boolean removeVertex(V vertex)
Description copied from interface: Hypergraph
Removes 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:

Specified by:
removeVertex in interface Hypergraph<V,E>
Parameters:
vertex - the vertex to remove
Returns:
true if the removal is successful, false otherwise
See Also:
Hypergraph.removeVertex(java.lang.Object)

containsEdge

public boolean containsEdge(E edge)
Description copied from interface: Hypergraph
Returns true if this graph's edge collection contains edge. Equivalent to getEdges().contains(edge).

Specified by:
containsEdge in interface Hypergraph<V,E>
Parameters:
edge - the edge whose presence is being queried
Returns:
true iff this graph contains an edge edge
See Also:
Hypergraph.containsEdge(java.lang.Object)

containsVertex

public boolean containsVertex(V vertex)
Description copied from interface: Hypergraph
Returns true if this graph's vertex collection contains vertex. Equivalent to getVertices().contains(vertex).

Specified by:
containsVertex in interface Hypergraph<V,E>
Parameters:
vertex - the vertex whose presence is being queried
Returns:
true iff this graph contains a vertex vertex
See Also:
Hypergraph.containsVertex(java.lang.Object)


Copyright © 2009. All Rights Reserved.