Algorithm
Development Kit 1.0

algs.model.network
Class DisjointPairs<A,B>

java.lang.Object
  extended by algs.model.network.DisjointPairs<A,B>
Type Parameters:
A - Type of object in set A
B - Type of object in set B

public class DisjointPairs<A,B>
extends java.lang.Object

Helper class to record pairing information for the Maximum Matching problem.

Ensures that sets A and B are disjoint while they are being created.

Once the network is generated, no more pairings can be added.


Constructor Summary
DisjointPairs()
           
 
Method Summary
 boolean add(A a, B b)
          Add a pairing (a,b) to the set.
 java.util.Iterator<EdgeInfo> getEdges()
          Return an array-based implementation of FlowNetwork based upon information contained within the bipartite graph.
 int numVertices()
           
 void output()
           
 int sinkIndex()
           
 int sourceIndex()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisjointPairs

public DisjointPairs()
Method Detail

add

public boolean add(A a,
                   B b)
Add a pairing (a,b) to the set.

If element a is an element of B or b is an element of A then this throws an IllegalArgumnetException.

Attempts to add the same pairing (which already exists) have no effect and false is returned when such an attempt is detected.

Parameters:
a -
b -

getEdges

public java.util.Iterator<EdgeInfo> getEdges()
Return an array-based implementation of FlowNetwork based upon information contained within the bipartite graph. 0th vertex is the new source.


sourceIndex

public int sourceIndex()

sinkIndex

public int sinkIndex()

numVertices

public int numVertices()

output

public void output()

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.