Class Edge<V>

  • Type Parameters:
    V - the type of the value of the nodes

    public class Edge<V>
    extends Object
    Class representing an edge in a graph. An edge has a weight.
    Author:
    Herbert Praehofer
    • Field Detail

      • from

        private final Node<V> from
        The source node of the edge
      • to

        private final Node<V> to
        The target node of the edge
      • weight

        private int weight
        The weight of the edge
    • Constructor Detail

      • Edge

        Edge​(Node<V> from,
             Node<V> to,
             int weight)
        Constructor setting source and target and weight.
        Parameters:
        from - the source node
        to - the target node
        weight - the weight
    • Method Detail

      • getFrom

        public Node<V> getFrom()
        Returns the source node
        Returns:
        the source node
      • getTo

        public Node<V> getTo()
        Returns the target node
        Returns:
        the target node
      • getWeight

        public int getWeight()
        Returns the weight
        Returns:
        the weight
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object