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)
| 3345 | |
| 3346 | |
| 3347 | def 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 | |
| 3371 | def rcmk_perm(g): |
no test coverage detected