edu.uci.ics.jung.graph.impl
Class SetHypergraph

java.lang.Object
  extended by edu.uci.ics.jung.utils.UserDataDelegate
      extended by edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph
          extended by edu.uci.ics.jung.graph.impl.SetHypergraph
All Implemented Interfaces:
ArchetypeGraph, Hypergraph, UserDataContainer, Cloneable

public class SetHypergraph
extends AbstractArchetypeGraph
implements Hypergraph

A basic implementation of Hypergraph. Edges and vertices are stored as Sets.

Author:
Joshua O'Madadhain

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph
AbstractArchetypeGraph.Requirements
 
Nested classes/interfaces inherited from interface edu.uci.ics.jung.utils.UserDataContainer
UserDataContainer.CopyAction
 
Field Summary
protected  Set edges
           
protected  Set vertices
           
 
Fields inherited from class edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph
edge_requirements, mEdgeIDs, mGraphListenerHandler, mVertexIDs, vertex_requirements
 
Fields inherited from class edu.uci.ics.jung.utils.UserDataDelegate
factory, udc_delegate
 
Fields inherited from interface edu.uci.ics.jung.graph.ArchetypeGraph
SUBSET_MANAGER
 
Constructor Summary
SetHypergraph()
           
 
Method Summary
 Hyperedge addEdge(Hyperedge e)
          Adds e to this graph, and returns a reference to the added edge.
 Hypervertex addVertex(Hypervertex v)
          Adds v to this graph, and returns a reference to the added vertex.
 Set getEdges()
          Returns a Set view of all edges in this graph.
 Set getVertices()
          Returns a Set view of all vertices in this graph.
 void initialize()
          Initializes all of the graph's internal data structures.
 void removeEdge(Hyperedge e)
          Removes the edge from this graph.
 void removeEdges(Set edges)
          Removes all vertices in the specified set from g.
 void removeVertex(Hypervertex v)
          Removes the vertex from this graph.
 void removeVertices(Set vertices)
          Removes all vertices in the specified set from g.
 
Methods inherited from class edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph
addAllNotInitializers, addListener, checkConstraints, copy, getEdgeConstraints, getVertexConstraints, listenersExist, newInstance, numEdges, numVertices, removeAllEdges, removeAllVertices, removeListener, toString
 
Methods inherited from class edu.uci.ics.jung.utils.UserDataDelegate
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDataFactory, setUserDatum
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.uci.ics.jung.graph.ArchetypeGraph
addListener, copy, getEdgeConstraints, getVertexConstraints, newInstance, numEdges, numVertices, removeAllEdges, removeAllVertices, removeListener
 
Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum
 

Field Detail

edges

protected Set edges

vertices

protected Set vertices
Constructor Detail

SetHypergraph

public SetHypergraph()
Method Detail

initialize

public void initialize()
Description copied from class: AbstractArchetypeGraph
Initializes all of the graph's internal data structures. Should always be called by any mechanism that creates a new instance of AbstractSparseGraph (for example, constructors and implementations of newInstance()). If you add predicates here, please set their isInitializeFlag to TRUE.

Note: this method is not a substitute for removeAllVertices(), as it will not notify the vertices and edges that they have been removed from the graph.

Overrides:
initialize in class AbstractArchetypeGraph

addVertex

public Hypervertex addVertex(Hypervertex v)
Description copied from interface: Hypergraph
Adds v to this graph, and returns a reference to the added vertex.

Specified by:
addVertex in interface Hypergraph
See Also:
Hypergraph.addVertex(edu.uci.ics.jung.graph.Hypervertex)

removeVertex

public void removeVertex(Hypervertex v)
Removes the vertex from this graph. If the vertex is an instance of AbstractElement, notifies it that it has been removed. Disconnects this vertex from any hyperedges to which it may be connected.

Specified by:
removeVertex in interface Hypergraph

addEdge

public Hyperedge addEdge(Hyperedge e)
Description copied from interface: Hypergraph
Adds e to this graph, and returns a reference to the added edge.

Specified by:
addEdge in interface Hypergraph
See Also:
Hypergraph.addEdge(edu.uci.ics.jung.graph.Hyperedge)

removeEdge

public void removeEdge(Hyperedge e)
Removes the edge from this graph. If the edge is an instance of AbstractElement, notifies it that it has been removed.

Specified by:
removeEdge in interface Hypergraph

getVertices

public Set getVertices()
Description copied from interface: ArchetypeGraph
Returns a Set view of all vertices in this graph. In general, this obeys the java.util.Set contract, and therefore makes no guarantees about the ordering of the vertices within the set.

Specified by:
getVertices in interface ArchetypeGraph
See Also:
ArchetypeGraph.getVertices()

getEdges

public Set getEdges()
Description copied from interface: ArchetypeGraph
Returns a Set view of all edges in this graph. In general, this obeys the java.util.Set contract, and therefore makes no guarantees about the ordering of the edges within the set.

Specified by:
getEdges in interface ArchetypeGraph
See Also:
ArchetypeGraph.getEdges()

removeVertices

public void removeVertices(Set vertices)
Removes all vertices in the specified set from g. Syntactic sugar for a loop that calls g.removeVertex on all elements of the set. If any element of vertices is not part of this graph, then throws IllegalArgumentException. If this exception is thrown, any vertices that may have been removed already are not guaranteed to be restored to the graph.

Specified by:
removeVertices in interface ArchetypeGraph
Parameters:
vertices - the set of vertices to be removed

removeEdges

public void removeEdges(Set edges)
Removes all vertices in the specified set from g. Syntactic sugar for a loop that calls g.removeVertex on all elements of the set. If any element of edges is not part of this graph, then throws IllegalArgumentException. If this exception is thrown, any edges that may have been removed already are not guaranteed to be restored to the graph.

Specified by:
removeEdges in interface ArchetypeGraph