add Edge
Adds a directed edge from node1 to node2. Nodes that don't exist in the graph yet are created.
Parameters
node1
The starting node of the edge.
node2
The ending node of the edge.
weight
The weight of the edge, for example used to calculate distances with shortestPathsFrom. Defaults to 1.0.