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): ...@@ -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. The key is the partition Id and the value is the DGLGraph of the partition.
''' '''
# METIS works only on symmetric graphs. # METIS works only on symmetric graphs.
g = to_bidirected(g, readonly=True) # The METIS runs on the symmetric graph to generate the node assignment to partitions.
node_part = _CAPI_DGLMetisPartition(g._graph, k) sym_g = to_bidirected(g, readonly=True)
node_part = _CAPI_DGLMetisPartition(sym_g._graph, k)
if len(node_part) == 0: if len(node_part) == 0:
return None return None
node_part = utils.toindex(node_part) 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) parts = partition_graph_with_halo(g, node_part, extra_cached_hops)
node_part = node_part.tousertensor() node_part = node_part.tousertensor()
for part_id in parts: 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