Package org.onlab.graph
Class DefaultEdgeWeigher<V extends Vertex,E extends Edge<V>>
- java.lang.Object
-
- org.onlab.graph.DefaultEdgeWeigher<V,E>
-
- Type Parameters:
V- vertex typeE- edge type
- All Implemented Interfaces:
EdgeWeigher<V,E>
public class DefaultEdgeWeigher<V extends Vertex,E extends Edge<V>> extends java.lang.Object implements EdgeWeigher<V,E>
Default weigher returns identical weight for every graph edge. Basically it is a hop count weigher. Produces weights ofScalarWeighttype.
-
-
Field Summary
Fields Modifier and Type Field Description static ScalarWeightDEFAULT_HOP_WEIGHTDefault weight based on hop count.static ScalarWeightDEFAULT_INITIAL_WEIGHTDefault initial weight.protected static doubleHOP_WEIGHT_VALUECommon weight value for any link.protected static doubleNULL_WEIGHT_VALUEWeight value for null path (without links).
-
Constructor Summary
Constructors Constructor Description DefaultEdgeWeigher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WeightgetInitialWeight()Returns initial weight value (i.e.WeightgetNonViableWeight()Returns weight of a link/path that should be skipped (can be considered as an infinite weight).Weightweight(E edge)Returns the weight of the given edge.
-
-
-
Field Detail
-
HOP_WEIGHT_VALUE
protected static final double HOP_WEIGHT_VALUE
Common weight value for any link.- See Also:
- Constant Field Values
-
NULL_WEIGHT_VALUE
protected static final double NULL_WEIGHT_VALUE
Weight value for null path (without links).- See Also:
- Constant Field Values
-
DEFAULT_HOP_WEIGHT
public static final ScalarWeight DEFAULT_HOP_WEIGHT
Default weight based on hop count. 1.0
-
DEFAULT_INITIAL_WEIGHT
public static final ScalarWeight DEFAULT_INITIAL_WEIGHT
Default initial weight. 0.0
-
-
Method Detail
-
weight
public Weight weight(E edge)
Description copied from interface:EdgeWeigherReturns the weight of the given edge.
-
getInitialWeight
public Weight getInitialWeight()
Description copied from interface:EdgeWeigherReturns initial weight value (i.e. weight of a "path" starting and terminating in the same vertex; typically 0 value is used).- Specified by:
getInitialWeightin interfaceEdgeWeigher<V extends Vertex,E extends Edge<V>>- Returns:
- null path weight
-
getNonViableWeight
public Weight getNonViableWeight()
Description copied from interface:EdgeWeigherReturns weight of a link/path that should be skipped (can be considered as an infinite weight).- Specified by:
getNonViableWeightin interfaceEdgeWeigher<V extends Vertex,E extends Edge<V>>- Returns:
- non viable weight
-
-