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:
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.double
getWeight()
Returns the weight of the spanning tree.boolean
isCapacitatedSpanningTree(Graph<V,E> graph, V root, double capacity, java.util.Map<V,java.lang.Double> demands)
Tests whethercmst
is a CMST ongraph
with rootroot
, capacitycapacity
and demand functiondemands
.java.lang.String
toString()
-
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.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
public java.util.Map<V,java.lang.Integer> 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
public java.util.Map<java.lang.Integer,Pair<java.util.Set<V>,java.lang.Double>> 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
public java.util.Set<E> 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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-