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
57daf9c9
Unverified
Commit
57daf9c9
authored
Dec 02, 2018
by
Minjie Wang
Committed by
GitHub
Dec 02, 2018
Browse files
[Graph] small fix on the all index (#219)
parent
57b07fce
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
10 deletions
+8
-10
python/dgl/graph.py
python/dgl/graph.py
+6
-2
python/dgl/graph_index.py
python/dgl/graph_index.py
+0
-6
python/dgl/immutable_graph_index.py
python/dgl/immutable_graph_index.py
+2
-2
No files found.
python/dgl/graph.py
View file @
57daf9c9
...
@@ -592,7 +592,9 @@ class DGLGraph(object):
...
@@ -592,7 +592,9 @@ class DGLGraph(object):
--------
--------
in_degree
in_degree
"""
"""
if
not
is_all
(
v
):
if
is_all
(
v
):
v
=
utils
.
toindex
(
slice
(
0
,
self
.
number_of_nodes
()))
else
:
v
=
utils
.
toindex
(
v
)
v
=
utils
.
toindex
(
v
)
return
self
.
_graph
.
in_degrees
(
v
).
tousertensor
()
return
self
.
_graph
.
in_degrees
(
v
).
tousertensor
()
...
@@ -632,7 +634,9 @@ class DGLGraph(object):
...
@@ -632,7 +634,9 @@ class DGLGraph(object):
--------
--------
out_degree
out_degree
"""
"""
if
not
is_all
(
v
):
if
is_all
(
v
):
v
=
utils
.
toindex
(
slice
(
0
,
self
.
number_of_nodes
()))
else
:
v
=
utils
.
toindex
(
v
)
v
=
utils
.
toindex
(
v
)
return
self
.
_graph
.
out_degrees
(
v
).
tousertensor
()
return
self
.
_graph
.
out_degrees
(
v
).
tousertensor
()
...
...
python/dgl/graph_index.py
View file @
57daf9c9
...
@@ -395,9 +395,6 @@ class GraphIndex(object):
...
@@ -395,9 +395,6 @@ class GraphIndex(object):
int
int
The in degree array.
The in degree array.
"""
"""
if
is_all
(
v
):
v
=
np
.
arange
(
0
,
self
.
number_of_nodes
(),
dtype
=
np
.
int64
)
v
=
utils
.
toindex
(
v
)
v_array
=
v
.
todgltensor
()
v_array
=
v
.
todgltensor
()
return
utils
.
toindex
(
_CAPI_DGLGraphInDegrees
(
self
.
_handle
,
v_array
))
return
utils
.
toindex
(
_CAPI_DGLGraphInDegrees
(
self
.
_handle
,
v_array
))
...
@@ -429,9 +426,6 @@ class GraphIndex(object):
...
@@ -429,9 +426,6 @@ class GraphIndex(object):
int
int
The out degree array.
The out degree array.
"""
"""
if
is_all
(
v
):
v
=
np
.
arange
(
0
,
self
.
number_of_nodes
(),
dtype
=
np
.
int64
)
v
=
utils
.
toindex
(
v
)
v_array
=
v
.
todgltensor
()
v_array
=
v
.
todgltensor
()
return
utils
.
toindex
(
_CAPI_DGLGraphOutDegrees
(
self
.
_handle
,
v_array
))
return
utils
.
toindex
(
_CAPI_DGLGraphOutDegrees
(
self
.
_handle
,
v_array
))
...
...
python/dgl/immutable_graph_index.py
View file @
57daf9c9
...
@@ -365,7 +365,7 @@ class ImmutableGraphIndex(object):
...
@@ -365,7 +365,7 @@ class ImmutableGraphIndex(object):
The in degree array.
The in degree array.
"""
"""
deg
=
self
.
_get_in_degree
()
deg
=
self
.
_get_in_degree
()
if
is_
all
(
v
):
if
v
.
is_
slice
(
0
,
self
.
number_of_nodes
()
):
return
utils
.
toindex
(
deg
)
return
utils
.
toindex
(
deg
)
else
:
else
:
v_array
=
v
.
tousertensor
()
v_array
=
v
.
tousertensor
()
...
@@ -401,7 +401,7 @@ class ImmutableGraphIndex(object):
...
@@ -401,7 +401,7 @@ class ImmutableGraphIndex(object):
The out degree array.
The out degree array.
"""
"""
deg
=
self
.
_get_out_degree
()
deg
=
self
.
_get_out_degree
()
if
is_
all
(
v
):
if
v
.
is_
slice
(
0
,
self
.
number_of_nodes
()
):
return
utils
.
toindex
(
deg
)
return
utils
.
toindex
(
deg
)
else
:
else
:
v_array
=
v
.
tousertensor
()
v_array
=
v
.
tousertensor
()
...
...
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