Class WeightedDirectedEdge<S extends Node,T extends Number>

Type Parameters:
S - the type of nodes connected by this edge, which must extend `Node`.
T - the type of the weight, which must extend `Number`.
All Implemented Interfaces:
WeightedEdge<S,T>

public class WeightedDirectedEdge<S extends Node,T extends Number> extends DirectedEdge<S> implements WeightedEdge<S,T>
The `WeightedDirectedEdge` class represents a directed edge between two nodes in a graph, with an associated weight.

This class extends the `DirectedEdge` class and implements the `WeightedEdge` interface, providing support for weighted directed edges. The weight of the edge is of type `T`, which is constrained to be a subtype of `Number`, allowing for numeric weights such as integers, floats, or doubles.

Author:
Lars Bengel, Sebastian Franke
  • Constructor Details

    • WeightedDirectedEdge

      public WeightedDirectedEdge(S nodeA, S nodeB, T weight)
      Creates a new weighted directed edge connecting two nodes with a given weight.
      Parameters:
      nodeA - the starting node of the edge.
      nodeB - the ending node of the edge.
      weight - the weight of the edge.
  • Method Details

    • getWeight

      public T getWeight()
      Returns the weight of this edge.
      Specified by:
      getWeight in interface WeightedEdge<S extends Node,T extends Number>
      Returns:
      the weight of this edge.
    • setWeight

      public void setWeight(T number)
      Sets the weight of this edge to the specified value.
      Parameters:
      number - the new weight of the edge.