Package org.jgrapht.alg.interfaces
Class MinimumVertexCoverAlgorithm.VertexCoverImpl<V>
- java.lang.Object
-
- org.jgrapht.alg.interfaces.MinimumVertexCoverAlgorithm.VertexCoverImpl<V>
-
- Type Parameters:
V- the vertex type
- All Implemented Interfaces:
MinimumVertexCoverAlgorithm.VertexCover<V>
- Enclosing interface:
- MinimumVertexCoverAlgorithm<V,E>
public static class MinimumVertexCoverAlgorithm.VertexCoverImpl<V> extends java.lang.Object implements MinimumVertexCoverAlgorithm.VertexCover<V>
Default implementation of a vertex cover
-
-
Constructor Summary
Constructors Constructor Description VertexCoverImpl(java.util.Set<V> cover, double weight)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<V>getVertices()Set of vertices constituting the vertex coverdoublegetWeight()Returns the weight of the vertex cover.java.lang.StringtoString()
-
-
-
Field Detail
-
cover
protected java.util.Set<V> cover
-
weight
protected double weight
-
-
Constructor Detail
-
VertexCoverImpl
public VertexCoverImpl(java.util.Set<V> cover, double weight)
-
-
Method Detail
-
getWeight
public double getWeight()
Description copied from interface:MinimumVertexCoverAlgorithm.VertexCoverReturns the weight of the vertex cover. When solving the minimum weighted vertex cover problem, the weight returned is the sum of the weights of the vertices in the cover. When solving the unweighted variant, the cardinality of the vertex cover is returned instead.- Specified by:
getWeightin interfaceMinimumVertexCoverAlgorithm.VertexCover<V>- Returns:
- weight of the vertex cover
-
getVertices
public java.util.Set<V> getVertices()
Description copied from interface:MinimumVertexCoverAlgorithm.VertexCoverSet of vertices constituting the vertex cover- Specified by:
getVerticesin interfaceMinimumVertexCoverAlgorithm.VertexCover<V>- Returns:
- vertices in the vertex cover
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-