|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.uci.ics.jung.utils.UserDataDelegate
edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph
edu.uci.ics.jung.graph.impl.AbstractSparseGraph
edu.uci.ics.jung.graph.impl.SparseGraph
edu.uci.ics.jung.graph.impl.UndirectedSparseGraph
edu.uci.ics.jung.graph.impl.BipartiteGraph
public class BipartiteGraph
A Bipartite graph is divided into A vertices and B vertices. Edges only connect A vertices to B vertices, and vice versa. This class extends UndirectedSparseGraph; thus, the Graph is made up of UndirectedSparseVertices.
Vertices can only be added to the graph with a flag that says which class they will be added to (using BipartiteGraph.Choice ); edges must be of type BipartiteGraph, which must consist of two vertices, one each from CLASSA and CLASSB.
BipartiteGraph bpg = new BipartiteGraph; Vertex va = bpg.addVertex( new UndirectedSparseVertex(), BipartiteGraph.CLASSA ); Vertex vb = bpg.addVertex( new UndirectedSparseVertex(), BipartiteGraph.CLASSB ); bpg.addBipartiteEdge( new BipartiteEdge( va, vb ));Note that the traditional addVertex() and addEdge() will both throw a FatalException.
The function fold creates an UndirectedGraph based on finding vertices that share a common neighbor.
| Nested Class Summary | |
|---|---|
static class |
BipartiteGraph.Choice
This small enumerated type merely forces a user to pick class "A" or "B" when adding a Vertex to a BipartiteGraph. |
| 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 | |
|---|---|
static Object |
BIPARTITE_USER_TAG
The tag for the UserData attached to a single Edge. |
static BipartiteGraph.Choice |
CLASSA
|
static BipartiteGraph.Choice |
CLASSB
|
| Fields inherited from class edu.uci.ics.jung.graph.impl.AbstractSparseGraph |
|---|
mEdges, mVertices |
| 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.Graph |
|---|
DIRECTED_EDGE, NOT_PARALLEL_EDGE, SIMPLE_EDGE, UNDIRECTED_EDGE |
| Fields inherited from interface edu.uci.ics.jung.graph.ArchetypeGraph |
|---|
SUBSET_MANAGER |
| Constructor Summary | |
|---|---|
BipartiteGraph()
|
|
| Method Summary | |
|---|---|
BipartiteEdge |
addBipartiteEdge(BipartiteEdge bpe)
Adds a BipartiteEdge to the Graph. |
Edge |
addEdge(Edge ae)
Deprecated. Use addBipartiteEdge |
BipartiteVertex |
addVertex(BipartiteVertex v,
BipartiteGraph.Choice choice)
Adds a single vertex to the graph in the specified partition. |
Vertex |
addVertex(Vertex av)
Deprecated. Use addBipartiteVertex |
static Graph |
fold(BipartiteGraph bpg,
BipartiteGraph.Choice vertexSet)
Creates a one-part graph from a bipartite graph by folding Vertices from one class into a second class. |
Set |
getAllVertices(BipartiteGraph.Choice choice)
Returns the set of all vertices from that class. |
BipartiteGraph.Choice |
getPartition(BipartiteVertex v)
Returns the partition for vertex v. |
void |
initialize()
Initializes all of the graph's internal data structures. |
void |
removeVertex(Vertex v)
Removes all edges adjacent to the specified vertex, removes the vertex, and notifies the vertex that it has been removed. |
| Methods inherited from class edu.uci.ics.jung.graph.impl.AbstractSparseGraph |
|---|
getEdges, getVertices, isDirected, removeEdge, removeEdges, removeVertices |
| 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.Graph |
|---|
isDirected, removeEdge |
| Methods inherited from interface edu.uci.ics.jung.graph.ArchetypeGraph |
|---|
addListener, copy, getEdgeConstraints, getEdges, getVertexConstraints, getVertices, newInstance, numEdges, numVertices, removeAllEdges, removeAllVertices, removeEdges, removeListener, removeVertices |
| Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer |
|---|
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum |
| Field Detail |
|---|
public static final BipartiteGraph.Choice CLASSA
public static final BipartiteGraph.Choice CLASSB
public static final Object BIPARTITE_USER_TAG
| Constructor Detail |
|---|
public BipartiteGraph()
| Method Detail |
|---|
public void initialize()
AbstractArchetypeGraph
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.
initialize in class AbstractSparseGraphpublic Set getAllVertices(BipartiteGraph.Choice choice)
public BipartiteGraph.Choice getPartition(BipartiteVertex v)
v.
v -
public BipartiteVertex addVertex(BipartiteVertex v,
BipartiteGraph.Choice choice)
Throws an IllegalArgumentException
if v is not an element of either partition.
v - the vertex to be added to the classchoice - the class to which the vertex should be added
public BipartiteEdge addBipartiteEdge(BipartiteEdge bpe)
bpe - a BipartiteEdge
public Edge addEdge(Edge ae)
addEdge in interface GraphaddEdge in class AbstractSparseGraphae - the edge to be addedAbstractSparseGraph.addEdge(edu.uci.ics.jung.graph.Edge)public Vertex addVertex(Vertex av)
addVertex in interface GraphaddVertex in class AbstractSparseGraphav - the vertex to be addedAbstractSparseGraph.addVertex(edu.uci.ics.jung.graph.Vertex)
public static Graph fold(BipartiteGraph bpg,
BipartiteGraph.Choice vertexSet)
bpg - The bipartite graph to be foldedvertexSet - Chooses the set of vertices to be brought into
the new Graph.
public void removeVertex(Vertex v)
AbstractSparseGraphAbstractSparseVertex.
removeVertex in interface GraphremoveVertex in class AbstractSparseGraph
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||