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
625f8a6b
Unverified
Commit
625f8a6b
authored
Oct 19, 2023
by
Mingbang Wang
Committed by
GitHub
Oct 19, 2023
Browse files
[GraphBolt] Modify `from_dglgraph()` (#6470)
parent
a6daf822
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
python/dgl/graphbolt/impl/csc_sampling_graph.py
python/dgl/graphbolt/impl/csc_sampling_graph.py
+12
-7
tests/python/pytorch/graphbolt/impl/test_csc_sampling_graph.py
.../python/pytorch/graphbolt/impl/test_csc_sampling_graph.py
+1
-2
No files found.
python/dgl/graphbolt/impl/csc_sampling_graph.py
View file @
625f8a6b
...
...
@@ -825,7 +825,12 @@ def from_dglgraph(
include_original_edge_id
:
bool
=
False
,
)
->
CSCSamplingGraph
:
"""Convert a DGLGraph to CSCSamplingGraph."""
homo_g
,
ntype_count
,
_
=
to_homogeneous
(
g
,
return_count
=
True
)
if
is_homogeneous
:
metadata
=
None
else
:
# Initialize metadata.
node_type_to_id
=
{
ntype
:
g
.
get_ntype_id
(
ntype
)
for
ntype
in
g
.
ntypes
}
edge_type_to_id
=
{
...
...
tests/python/pytorch/graphbolt/impl/test_csc_sampling_graph.py
View file @
625f8a6b
...
...
@@ -1321,8 +1321,7 @@ def test_from_dglgraph_homogeneous():
assert
gb_g
.
total_num_edges
==
dgl_g
.
num_edges
()
assert
torch
.
equal
(
gb_g
.
node_type_offset
,
torch
.
tensor
([
0
,
1000
]))
assert
gb_g
.
type_per_edge
is
None
assert
gb_g
.
metadata
.
node_type_to_id
==
{
"_N"
:
0
}
assert
gb_g
.
metadata
.
edge_type_to_id
==
{
"_N:_E:_N"
:
0
}
assert
gb_g
.
metadata
is
None
@
unittest
.
skipIf
(
...
...
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