edu.uci.ics.jung.algorithms.transformation
Class KPartiteFolder

java.lang.Object
  extended byedu.uci.ics.jung.algorithms.transformation.KPartiteFolder

public class KPartiteFolder
extends java.lang.Object

Author:
danyelf

Field Summary
static java.lang.String FOLDED_DATA
          Used in fold() as a user data key to the data attached to the edges in the folded graph.
 
Constructor Summary
KPartiteFolder(boolean parallel)
          Creates an instance of this Folder.
 
Method Summary
 Graph fold(KPartiteGraph g, org.apache.commons.collections.Predicate p)
           Converts g into a unipartite graph whose vertex set is the vertices whose partition is specified by p.
 void setParallel(boolean parallel)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FOLDED_DATA

public static final java.lang.String FOLDED_DATA
Used in fold() as a user data key to the data attached to the edges in the folded graph.

See Also:
Constant Field Values
Constructor Detail

KPartiteFolder

public KPartiteFolder(boolean parallel)
Creates an instance of this Folder. See the discussion of fold for notes on the "parallel" argument.

Method Detail

setParallel

public void setParallel(boolean parallel)

fold

public Graph fold(KPartiteGraph g,
                  org.apache.commons.collections.Predicate p)

Converts g into a unipartite graph whose vertex set is the vertices whose partition is specified by p. For vertices a and b in this partition, the resultant graph will include the edge (a,b) if the original graph contains edges (a,c) and (c,b) for at least one vertex c.

If parallel is true, then each such connecting vertex c will be represented by a single edge in the resultant graph, and the resultant graph may therefore contain parallel edges. Otherwise, each edge (a,b) in the resultant graph will be annotated with the set of vertices c that connected a to b in the original graph, and the graph's edge requirements will be set to refuse parallel edges.

In either case, if there is an edge from (a) to (b), and a distinct edge from (b) to (a), then a self

If g is neither strictly directed nor strictly undirected, or allows parallel edges, this method throws IllegalArgumentException.

Parameters:
g - the graph to convert
p - the predicate which specifies the partition to fold into
Throws:
java.lang.IllegalArgumentException