Unverified Commit a3f10c21 authored by Zihao Ye's avatar Zihao Ye Committed by GitHub
Browse files

[bugfix] Fixed bug in `from_networkx` (#603)

* minor fix

* small fix
parent c5ab5b72
......@@ -952,7 +952,11 @@ def from_networkx(nx_graph, readonly):
num_nodes = nx_graph.number_of_nodes()
# nx_graph.edges(data=True) returns src, dst, attr_dict
if nx_graph.number_of_edges() > 0:
has_edge_id = 'id' in next(iter(nx_graph.edges(data=True)))[-1]
else:
has_edge_id = False
if has_edge_id:
num_edges = nx_graph.number_of_edges()
src = np.zeros((num_edges,), dtype=np.int64)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment