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
-
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.double
Returns the weight of the spanning tree.boolean
Tests whethercmst
is a CMST ongraph
with rootroot
, capacitycapacity
and demand functiondemands
.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods 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.CapacitatedSpanningTree
Tests whethercmst
is a CMST ongraph
with rootroot
, capacitycapacity
and demand functiondemands
.- Specified by:
isCapacitatedSpanningTree
in interfaceCapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,
E> - Parameters:
graph
- the graphroot
- the expected root of cmstcapacity
- the expected capacity of cmstdemands
- the demand function- Returns:
- whether
cmst
is a CMST
-
getLabels
Description copied from interface:CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree
Return 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:
getLabels
in interfaceCapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,
E> - Returns:
- the label set of the capacitated spanning tree.
-
getPartition
Description copied from interface:CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree
Return the label-to-partition map of the underlying partition of capacitated spanning tree.- Specified by:
getPartition
in 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.SpanningTree
Returns the weight of the spanning tree.- Specified by:
getWeight
in interfaceSpanningTreeAlgorithm.SpanningTree<V>
- Returns:
- weight of the spanning tree
-
getEdges
Description copied from interface:SpanningTreeAlgorithm.SpanningTree
Set of edges of the spanning tree.- Specified by:
getEdges
in interfaceSpanningTreeAlgorithm.SpanningTree<V>
- Returns:
- edge set of the spanning tree
-
toString
-