MCPcopy Index your code
hub / github.com/dmlc/dgl / rcmk_perm

Function rcmk_perm

python/dgl/transforms/functional.py:3371–3392  ·  view source on GitHub ↗

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

(g)

Source from the content-addressed store, hash-verified

3369
3370
3371def 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
3395def norm_by_dst(g, etype=None):

Callers 1

reorder_graphFunction · 0.85

Calls 4

adj_externalMethod · 0.80
sumFunction · 0.50
valuesMethod · 0.45
formatsMethod · 0.45

Tested by

no test coverage detected