Class DefaultEdgeWeigher<V extends Vertex,​E extends Edge<V>>

  • Type Parameters:
    V - vertex type
    E - 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 of ScalarWeight type.
    • 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
    • Constructor Detail

      • DefaultEdgeWeigher

        public DefaultEdgeWeigher()
    • Method Detail

      • weight

        public Weight weight​(E edge)
        Description copied from interface: EdgeWeigher
        Returns the weight of the given edge.
        Specified by:
        weight in interface EdgeWeigher<V extends Vertex,​E extends Edge<V>>
        Parameters:
        edge - edge to be weighed
        Returns:
        edge weight
      • 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 interface EdgeWeigher<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 interface EdgeWeigher<V extends Vertex,​E extends Edge<V>>
        Returns:
        non viable weight