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
34981bd6
Unverified
Commit
34981bd6
authored
May 08, 2022
by
Quan (Andy) Gan
Committed by
GitHub
May 08, 2022
Browse files
[Doc] Fix compact_graphs example docstring (#3953)
Co-authored-by:
Minjie Wang
<
wmjlyjemaine@gmail.com
>
parent
b2ec5a2e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
python/dgl/transforms/functional.py
python/dgl/transforms/functional.py
+4
-4
No files found.
python/dgl/transforms/functional.py
View file @
34981bd6
...
...
@@ -1994,8 +1994,8 @@ def compact_graphs(graphs, always_preserve=None, copy_ndata=True, copy_edata=Tru
The following would compact the graph above to another bipartite graph with only
two users and two games.
>>> new_g
, induced_nodes
= dgl.compact_graphs(g)
>>>
induced_nodes
>>> new_g = dgl.compact_graphs(g)
>>>
new_g.ndata[dgl.NID]
{'user': tensor([1, 3]), 'game': tensor([3, 5])}
The mapping tells us that only user #1 and #3 as well as game #3 and #5 are kept.
...
...
@@ -2013,8 +2013,8 @@ def compact_graphs(graphs, always_preserve=None, copy_ndata=True, copy_edata=Tru
>>> g2 = dgl.heterograph({('user', 'plays', 'game'): ([1, 6], [6, 8])},
>>> {'user': 20, 'game': 10})
>>>
(
new_g, new_g2
), induced_nodes
= dgl.compact_graphs([g, g2])
>>>
induced_nodes
>>> new_g, new_g2 = dgl.compact_graphs([g, g2])
>>>
new_g.ndata[dgl.NID]
{'user': tensor([1, 3, 6]), 'game': tensor([3, 5, 6, 8])}
Then one can see that user #1 from both graphs, users #3 from the first graph, as
...
...
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