i am using python library networkx to create direct graph
graph = nx.DiGraph
graph.add_edges_from(edges)
graph.add_nodes_from(isolated_nodes)
nothing went wrong until yesterday, add i got error below:
TypeError: add_edges_from() missing 1 required positional argument: 'ebunch'
But, i acturally passed a tuple list as container of edges, and another list of int as container of nodes.
I print edges tuple list and nodes list I passed into methods and the error that shown as below:
so to simplify the problem, i test to add one edge or one node like below:
graph.add_edge(1,2)
graph.add_node(3)
and I still got
TypeError: add_edge() missing 1 required positional argument: 'v', or add_node() missing 1 required positional argument: 'n'
it's weried I can't figure out what's going wrong?
You never created a graph because you never called the constructor. Must be:
graph = nx.DiGraph() # Note the ()!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With