edu.uci.ics.jung.algorithms.blockmodel
Class EquivalenceRelation<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.algorithms.blockmodel.EquivalenceRelation<V,E>

public class EquivalenceRelation<V,E>
extends Object

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

Author:
danyelf, Tom Nelson - converted to jung2

Constructor Summary
EquivalenceRelation(Set<Set<V>> rv, Graph<V,E> g)
          Input is the basic data structure underneath: a Set of Sets.
 
Method Summary
 Iterator<Set<V>> getAllEquivalences()
          Iterates through all the equivalence sets.
 Set<V> getEquivalenceRelationContaining(V 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<V,E> getGraph()
          Returns the common graph to which all the vertices belong
 Set<V> getSingletonVertices()
          Returns the set of vertices that do not belong to an particular equivalence class.
 int numRelations()
          Returns the number of relations defined.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EquivalenceRelation

public EquivalenceRelation(Set<Set<V>> rv,
                           Graph<V,E> 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<V,E> getGraph()
Returns the common graph to which all the vertices belong


getSingletonVertices

public Set<V> 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 Iterator<Set<V>> getAllEquivalences()
Iterates through all the equivalence sets. Does not return any singletons.

Returns:
an Iterator of Sets of vertices.

getEquivalenceRelationContaining

public Set<V> getEquivalenceRelationContaining(V 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 String toString()
Overrides:
toString in class Object


Copyright © 2007. All Rights Reserved.