Package algs44

Class DirectedEdge

java.lang.Object
algs44.DirectedEdge
All Implemented Interfaces:
Comparable<DirectedEdge>

public class DirectedEdge extends Object implements Comparable<DirectedEdge>
The DirectedEdge class represents a weighted edge in an directed graph.

For additional documentation, see Section 4.4 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
     
    private final int
     
    private final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DirectedEdge(int v, int w, double weight)
    Create a directed edge from v to w with given weight.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compare by weights.
    int
    Return the vertex where this edge begins.
    static void
    main(String[] args)
    Test client.
    int
    to()
    Return the vertex where this edge ends.
    Return a string representation of this edge.
    double
    Return the weight of this edge.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • v

      private final int v
    • w

      private final int w
    • weight

      private final double weight
  • Constructor Details

    • DirectedEdge

      public DirectedEdge(int v, int w, double weight)
      Create a directed edge from v to w with given weight.
  • Method Details