org.jgrapht.alg.interfaces

## Interface MatchingAlgorithm.Matching<V,E>

• Type Parameters:
V - the graph vertex type
E - the graph edge type
All Superinterfaces:
Iterable<E>
All Known Implementing Classes:
MatchingAlgorithm.MatchingImpl
Enclosing interface:
MatchingAlgorithm<V,E>

public static interface MatchingAlgorithm.Matching<V,E>
extends Iterable<E>
A graph matching.
• ### Method Summary

All Methods
Modifier and Type Method and Description
Set<E> getEdges()
Get the edges of the matching.
Graph<V,E> getGraph()
Returns the graph over which this matching is defined.
double getWeight()
Returns the weight of the matching.
default boolean isMatched(V v)
Returns true if vertex v is incident to an edge in this matching.
default boolean isPerfect()
Returns true if the matching is a perfect matching.
default Iterator<E> iterator()
Returns an iterator over the edges in the matching.
• ### Methods inherited from interface java.lang.Iterable

forEach, spliterator
• ### Method Detail

• #### getGraph

Graph<V,E> getGraph()
Returns the graph over which this matching is defined.
Returns:
the graph
• #### getWeight

double getWeight()
Returns the weight of the matching.
Returns:
the weight of the matching
• #### getEdges

Set<E> getEdges()
Get the edges of the matching.
Returns:
the edges of the matching
• #### isMatched

default boolean isMatched(V v)
Returns true if vertex v is incident to an edge in this matching.
Parameters:
v - vertex
Returns:
true if vertex v is incident to an edge in this matching.
• #### isPerfect

default boolean isPerfect()
Returns true if the matching is a perfect matching. A matching is perfect if every vertex in the graph is incident to an edge in the matching.
Returns:
true if the matching is perfect. By definition, a perfect matching consists of exactly $\frac{1}{2|V|}$ edges, and the number of vertices in the graph must be even.
• #### iterator

default Iterator<E> iterator()
Returns an iterator over the edges in the matching.
Specified by:
iterator in interface Iterable<E>
Returns:
iterator over the edges in the matching.