edu.uci.ics.jung.algorithms.blockmodel
Class EquivalenceRelation

java.lang.Object
  extended byedu.uci.ics.jung.algorithms.blockmodel.EquivalenceRelation

public class EquivalenceRelation
extends java.lang.Object

An EquivalenceRelation holds a number of Equivalent vertices from the same graph. created Feb 3, 2004

Author:
danyelf

Constructor Summary
EquivalenceRelation(java.util.Set rv, Graph g)
          Input is the basic data structure underneath: a Set of Sets.
 
Method Summary
 java.util.Iterator getAllEquivalences()
          Iterates through all the equivalence sets.
 java.util.Set getEquivalenceRelationContaining(Vertex v)
          Returns the part of the relation that contains this vertex: it is, of course, a Set If the vertex does not belong to any relation, null is returned.
 Graph getGraph()
          Returns the common graph to which all the vertices belong
 java.util.Set getSingletonVertices()
          Returns the set of vertices that do not belong to an particular equivalence class.
 int numRelations()
          Returns the number of relations defined.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EquivalenceRelation

public EquivalenceRelation(java.util.Set rv,
                           Graph g)
Input is the basic data structure underneath: a Set of Sets. The sets must be mutually exclusive, non-empty, and contain only vertices from the graph. A reference to the underlying sets is maintained; be careful not to accidently modify them after the ER is created.

Method Detail

getGraph

public Graph getGraph()
Returns the common graph to which all the vertices belong


getSingletonVertices

public java.util.Set getSingletonVertices()
Returns the set of vertices that do not belong to an particular equivalence class. Takes O(n) time by walking through the whole graph and checking all vertices that are not in any equivalence relation.


getAllEquivalences

public java.util.Iterator getAllEquivalences()
Iterates through all the equivalence sets. Does not return any singletons.

Returns:
an Iterator of Sets of vertices.

getEquivalenceRelationContaining

public java.util.Set getEquivalenceRelationContaining(Vertex v)
Returns the part of the relation that contains this vertex: it is, of course, a Set If the vertex does not belong to any relation, null is returned.


numRelations

public int numRelations()
Returns the number of relations defined.


toString

public java.lang.String toString()