"docs/vscode:/vscode.git/clone" did not exist on "189c2c0907cdff54f733299a93360ddfcff4ccb7"
Unverified Commit 3938b399 authored by Da Zheng's avatar Da Zheng Committed by GitHub
Browse files

[BUGFIX] metis partition should generate a subgraph to the original graph. (#1352)

* fix a partition.

* add comments.
parent 1a584ced
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment