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
3938b399
Unverified
Commit
3938b399
authored
Mar 11, 2020
by
Da Zheng
Committed by
GitHub
Mar 12, 2020
Browse files
[BUGFIX] metis partition should generate a subgraph to the original graph. (#1352)
* fix a partition. * add comments.
parent
1a584ced
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
python/dgl/transform.py
python/dgl/transform.py
+4
-2
No files found.
python/dgl/transform.py
View file @
3938b399
...
...
@@ -595,12 +595,14 @@ def metis_partition(g, k, extra_cached_hops=0):
The key is the partition Id and the value is the DGLGraph of the partition.
'''
# METIS works only on symmetric graphs.
g
=
to_bidirected
(
g
,
readonly
=
True
)
node_part
=
_CAPI_DGLMetisPartition
(
g
.
_graph
,
k
)
# The METIS runs on the symmetric graph to generate the node assignment to partitions.
sym_g
=
to_bidirected
(
g
,
readonly
=
True
)
node_part
=
_CAPI_DGLMetisPartition
(
sym_g
.
_graph
,
k
)
if
len
(
node_part
)
==
0
:
return
None
node_part
=
utils
.
toindex
(
node_part
)
# Then we split the original graph into parts based on the METIS partitioning results.
parts
=
partition_graph_with_halo
(
g
,
node_part
,
extra_cached_hops
)
node_part
=
node_part
.
tousertensor
()
for
part_id
in
parts
:
...
...
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