Module org.jgrapht.core
Package org.jgrapht.alg.interfaces
Interface MatchingAlgorithm.Matching<V,E>
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Superinterfaces:
Iterable<E>
- All Known Implementing Classes:
MatchingAlgorithm.MatchingImpl
- Enclosing interface:
- MatchingAlgorithm<V,
E>
A graph matching.
-
Method Summary
Modifier and TypeMethodDescriptiongetEdges()
Get the edges of the matching.getGraph()
Returns the graph over which this matching is defined.double
Returns the weight of the matching.default boolean
Returns true if vertex v is incident to an edge in this matching.default boolean
Returns true if the matching is a perfect matching.iterator()
Returns an iterator over the edges in the matching.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
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
Get the edges of the matching.- Returns:
- the edges of the matching
-
isMatched
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
Returns an iterator over the edges in the matching.
-