Package org.jgrapht.alg.interfaces
Interface MatchingAlgorithm.Matching<V,E>
-
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Superinterfaces:
java.lang.Iterable<E>
- All Known Implementing Classes:
MatchingAlgorithm.MatchingImpl
- Enclosing interface:
- MatchingAlgorithm<V,E>
public static interface MatchingAlgorithm.Matching<V,E> extends java.lang.Iterable<E>
A graph matching.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.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 java.util.Iterator<E>
iterator()
Returns an iterator over the edges in the matching.
-
-
-
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
java.util.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.
-
-