Class LinkEdge<LINK extends Link>

  • Type Parameters:
    LINK - the link type.
    All Implemented Interfaces:
    Serializable, Cloneable

    public class LinkEdge<LINK extends Link>
    extends org.jgrapht.graph.DefaultWeightedEdge
    The LinkEdge is a class that embeds a Link (extension of AbstractLink) to be put in a graph. Typical code to add a link called link with nodes nodeA and nodeB to a graph is:
     SimpleWeightedGraph<Node, LinkEdge> linkGraph = new SimpleWeightedGraph<>(LinkEdge.class);
     ...
     Link link = new Link(nodeA, nodeB, name);
     LinkEdge linkEdge = new LinkEdge(link);
     linkGraph.addEdge(nodeA, nodeB, linkEdge);
     linkGraph.setEdgeWeight(linkEdge, link.getLength().doubleValue());
     

    Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    $LastChangedDate$, @version $Revision$, by $Author$, initial version Sep 12, 2014

    Author:
    Alexander Verbraeck
    See Also:
    Serialized Form
    • Constructor Detail

      • LinkEdge

        public LinkEdge​(LINK link)
        Parameters:
        link - LINK; the edge to take into the graph.
    • Method Detail

      • getLink

        public final LINK getLink()
        Returns:
        the link that is taken as an edge in the graph.
      • toString

        public final String toString()
        Overrides:
        toString in class org.jgrapht.graph.DefaultWeightedEdge