Module org.jgrapht.core
Package org.jgrapht.alg.interfaces
Class CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTreeImpl<V,E>
java.lang.Object
org.jgrapht.alg.interfaces.CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTreeImpl<V,E>
- Type Parameters:
V- the graph vertex typeE- the graph edge type
- All Implemented Interfaces:
Serializable,Iterable<E>,CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,,E> SpanningTreeAlgorithm.SpanningTree<E>
- Enclosing interface:
- CapacitatedSpanningTreeAlgorithm<V,
E>
public static class CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTreeImpl<V,E>
extends Object
implements CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,E>, Serializable
Default implementation of the spanning tree interface.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEdges()Set of edges of the spanning tree.Return the set of labels of the underlying partition of the capacitated spanning tree.Return the label-to-partition map of the underlying partition of capacitated spanning tree.doubleReturns the weight of the spanning tree.booleanTests whethercmstis a CMST ongraphwith rootroot, capacitycapacityand demand functiondemands.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.jgrapht.alg.interfaces.SpanningTreeAlgorithm.SpanningTree
iterator
-
Constructor Details
-
CapacitatedSpanningTreeImpl
public CapacitatedSpanningTreeImpl(Map<V, Integer> labels, Map<Integer, Pair<Set<V>, Double>> partition, Set<E> edges, double weight) Construct a new capacitated spanning tree.- Parameters:
labels- the labelling of the vertices marking their subset membership in the partitionpartition- the implicitly defined partition of the vertices in the capacitated spanning treeedges- the edge set of the capacitated spanning treeweight- the weight of the capacitated spanning tree, i.e. the sum of all edge weights
-
-
Method Details
-
isCapacitatedSpanningTree
public boolean isCapacitatedSpanningTree(Graph<V, E> graph, V root, double capacity, Map<V, Double> demands) Description copied from interface:CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTreeTests whethercmstis a CMST ongraphwith rootroot, capacitycapacityand demand functiondemands.- Specified by:
isCapacitatedSpanningTreein interfaceCapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,E> - Parameters:
graph- the graphroot- the expected root of cmstcapacity- the expected capacity of cmstdemands- the demand function- Returns:
- whether
cmstis a CMST
-
getLabels
Description copied from interface:CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTreeReturn the set of labels of the underlying partition of the capacitated spanning tree. The labels are a key to the vertex sets of the partition.- Specified by:
getLabelsin interfaceCapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,E> - Returns:
- the label set of the capacitated spanning tree.
-
getPartition
Description copied from interface:CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTreeReturn the label-to-partition map of the underlying partition of capacitated spanning tree.- Specified by:
getPartitionin interfaceCapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,E> - Returns:
- map from labels to the subsets of the partition of the capacitated spanning tree.
-
getWeight
public double getWeight()Description copied from interface:SpanningTreeAlgorithm.SpanningTreeReturns the weight of the spanning tree.- Specified by:
getWeightin interfaceSpanningTreeAlgorithm.SpanningTree<V>- Returns:
- weight of the spanning tree
-
getEdges
Description copied from interface:SpanningTreeAlgorithm.SpanningTreeSet of edges of the spanning tree.- Specified by:
getEdgesin interfaceSpanningTreeAlgorithm.SpanningTree<V>- Returns:
- edge set of the spanning tree
-
toString
-