Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
a3f10c21
Unverified
Commit
a3f10c21
authored
Jun 04, 2019
by
Zihao Ye
Committed by
GitHub
Jun 04, 2019
Browse files
[bugfix] Fixed bug in `from_networkx` (#603)
* minor fix * small fix
parent
c5ab5b72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
python/dgl/graph_index.py
python/dgl/graph_index.py
+5
-1
No files found.
python/dgl/graph_index.py
View file @
a3f10c21
...
...
@@ -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
has_edge_id
=
'id'
in
next
(
iter
(
nx_graph
.
edges
(
data
=
True
)))[
-
1
]
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment