MCPcopy
hub / github.com/dmlc/dgl / metis_perm

Function metis_perm

python/dgl/transforms/functional.py:3347–3368  ·  view source on GitHub ↗

r"""Return nodes permutation according to ``'metis'`` algorithm. For internal use. Parameters ---------- g : DGLGraph The homogeneous graph. k: int The partition parts number. Returns ------- iterable[int] The nodes permutation.

(g, k)

Source from the content-addressed store, hash-verified

3345
3346
3347def metis_perm(g, k):
3348 r"""Return nodes permutation according to ``'metis'`` algorithm.
3349
3350 For internal use.
3351
3352 Parameters
3353 ----------
3354 g : DGLGraph
3355 The homogeneous graph.
3356 k: int
3357 The partition parts number.
3358
3359 Returns
3360 -------
3361 iterable[int]
3362 The nodes permutation.
3363 """
3364 pids = metis_partition_assignment(
3365 g if g.device == F.cpu() else g.to(F.cpu()), k
3366 )
3367 pids = F.asnumpy(pids)
3368 return np.argsort(pids).copy()
3369
3370
3371def rcmk_perm(g):

Callers 1

reorder_graphFunction · 0.85

Calls 4

asnumpyMethod · 0.80
cpuMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected