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:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<E>getEdges()Set of edges of the spanning tree.Map<V,Integer>getLabels()Return the set of labels of the underlying partition of the capacitated spanning tree.Map<Integer,Pair<Set<V>,Double>>getPartition()Return the label-to-partition map of the underlying partition of capacitated spanning tree.doublegetWeight()Returns the weight of the spanning tree.booleanisCapacitatedSpanningTree(Graph<V,E> graph, V root, double capacity, Map<V,Double> demands)Tests whethercmstis a CMST ongraphwith rootroot, capacitycapacityand demand functiondemands.StringtoString()-
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 Detail
-
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 Detail
-
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
public Map<V,Integer> 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
public Map<Integer,Pair<Set<V>,Double>> 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
public Set<E> 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
-
-