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 ofScalarWeight
type.
-
-
Field Summary
Fields Modifier and Type Field Description static ScalarWeight
DEFAULT_HOP_WEIGHT
Default weight based on hop count.static ScalarWeight
DEFAULT_INITIAL_WEIGHT
Default initial weight.protected static double
HOP_WEIGHT_VALUE
Common weight value for any link.protected static double
NULL_WEIGHT_VALUE
Weight 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 Weight
getInitialWeight()
Returns initial weight value (i.e.Weight
getNonViableWeight()
Returns weight of a link/path that should be skipped (can be considered as an infinite weight).Weight
weight(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:EdgeWeigher
Returns the weight of the given edge.
-
getInitialWeight
public Weight getInitialWeight()
Description copied from interface:EdgeWeigher
Returns initial weight value (i.e. weight of a "path" starting and terminating in the same vertex; typically 0 value is used).- Specified by:
getInitialWeight
in interfaceEdgeWeigher<V extends Vertex,E extends Edge<V>>
- Returns:
- null path weight
-
getNonViableWeight
public Weight getNonViableWeight()
Description copied from interface:EdgeWeigher
Returns weight of a link/path that should be skipped (can be considered as an infinite weight).- Specified by:
getNonViableWeight
in interfaceEdgeWeigher<V extends Vertex,E extends Edge<V>>
- Returns:
- non viable weight
-
-