public final class Matching extends Object
match(int, int)
, any existing match for the newly matched
vertices is no-longer available. The status of a vertex can be queried with
matched(int)
and the matched vertex obtained with other(int)
.Modifier and Type | Method and Description |
---|---|
void |
match(int u,
int v)
Add the edge '{u,v}' to the matched edge set.
|
boolean |
matched(int v)
Determine if a vertex has a match.
|
int |
other(int v)
Access the vertex matched with 'v'.
|
boolean |
perfect(int[][] graph,
BitSet subset)
Attempt to augment the matching such that it is perfect over the subset
of vertices in the provided graph.
|
String |
toString() |
void |
unmatch(int v)
Remove a matching for the specified vertex.
|
boolean |
unmatched(int v)
Determine if a vertex is not matched.
|
static Matching |
withCapacity(int capacity)
Create an empty matching with the specified capacity.
|
public void match(int u, int v)
u
- a vertexv
- another vertexpublic int other(int v)
v
- vertexIllegalArgumentException
- the vertex is currently unmatchedpublic void unmatch(int v)
v
- vertexpublic boolean matched(int v)
v
- vertexpublic boolean unmatched(int v)
v
- a vertexpublic boolean perfect(int[][] graph, BitSet subset)
graph
- adjacency list representation of graphsubset
- subset of verticesIllegalArgumentException
- the graph was a different size to the
matching capacitypublic static Matching withCapacity(int capacity)
capacity
- maximum number of verticesCopyright © 2018. All Rights Reserved.