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:
java.io.Serializable,java.lang.Iterable<E>,CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,E>,SpanningTreeAlgorithm.SpanningTree<E>
- Enclosing interface:
- CapacitatedSpanningTreeAlgorithm<V,E>
public static class CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTreeImpl<V,E> extends java.lang.Object implements CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,E>, java.io.Serializable
Default implementation of the spanning tree interface.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CapacitatedSpanningTreeImpl(java.util.Map<V,java.lang.Integer> labels, java.util.Map<java.lang.Integer,Pair<java.util.Set<V>,java.lang.Double>> partition, java.util.Set<E> edges, double weight)Construct a new capacitated spanning tree.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<E>getEdges()Set of edges of the spanning tree.java.util.Map<V,java.lang.Integer>getLabels()Return the set of labels of the underlying partition of the capacitated spanning tree.java.util.Map<java.lang.Integer,Pair<java.util.Set<V>,java.lang.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, java.util.Map<V,java.lang.Double> demands)Tests whethercmstis a CMST ongraphwith rootroot, capacitycapacityand demand functiondemands.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jgrapht.alg.interfaces.SpanningTreeAlgorithm.SpanningTree
iterator
-
-
-
-
Constructor Detail
-
CapacitatedSpanningTreeImpl
public CapacitatedSpanningTreeImpl(java.util.Map<V,java.lang.Integer> labels, java.util.Map<java.lang.Integer,Pair<java.util.Set<V>,java.lang.Double>> partition, java.util.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, java.util.Map<V,java.lang.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 java.util.Map<V,java.lang.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 java.util.Map<java.lang.Integer,Pair<java.util.Set<V>,java.lang.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 java.util.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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-