The correct way to create a graph is to first create nodes of the right type (AdjacencyListGraphNode or AdjacencyListMatrixNode) and then add these nodes to the graph. Once done, add edges between these nodes.
A note should be added in the class doc string for the above process.
In the doc string of add_edge it should be clarified that this function will assume that the nodes are already present in the graph. If they are not present, then this function will not add the new nodes on it's own. In case someone attempts to do that then a nice error message should be raised describing the same.
Description of the problem
The correct way to create a graph is to first create nodes of the right type (
AdjacencyListGraphNode
orAdjacencyListMatrixNode
) and then add these nodes to the graph. Once done, add edges between these nodes.add_edge
it should be clarified that this function will assume that the nodes are already present in the graph. If they are not present, then this function will not add the new nodes on it's own. In case someone attempts to do that then a nice error message should be raised describing the same.Example of the problem
References/Other comments
cc: @pratikgl