r"""Return nodes permutation according to ``'rcmk'`` algorithm. For internal use. Parameters ---------- g : DGLGraph The homogeneous graph. Returns ------- iterable[int] The nodes permutation.
(g)
| 3369 | |
| 3370 | |
| 3371 | def rcmk_perm(g): |
| 3372 | r"""Return nodes permutation according to ``'rcmk'`` algorithm. |
| 3373 | |
| 3374 | For internal use. |
| 3375 | |
| 3376 | Parameters |
| 3377 | ---------- |
| 3378 | g : DGLGraph |
| 3379 | The homogeneous graph. |
| 3380 | |
| 3381 | Returns |
| 3382 | ------- |
| 3383 | iterable[int] |
| 3384 | The nodes permutation. |
| 3385 | """ |
| 3386 | fmat = "csr" |
| 3387 | allowed_fmats = sum(g.formats().values(), []) |
| 3388 | if fmat not in allowed_fmats: |
| 3389 | g = g.formats(allowed_fmats + [fmat]) |
| 3390 | csr_adj = g.adj_external(scipy_fmt=fmat) |
| 3391 | perm = sparse.csgraph.reverse_cuthill_mckee(csr_adj) |
| 3392 | return perm.copy() |
| 3393 | |
| 3394 | |
| 3395 | def norm_by_dst(g, etype=None): |
no test coverage detected