MCPcopy
hub / github.com/dask/dask / getcycle

Function getcycle

dask/core.py:460–479  ·  view source on GitHub ↗

Return a list of nodes that form a cycle if Dask is not a DAG. Returns an empty list if no cycle is found. ``keys`` may be a single key or list of keys. Examples -------- >>> inc = lambda x: x + 1 >>> d = {'x': (inc, 'z'), 'y': (inc, 'x'), 'z': (inc, 'y')} >>> getcycl

(d, keys)

Source from the content-addressed store, hash-verified

458
459
460def getcycle(d, keys):
461 """Return a list of nodes that form a cycle if Dask is not a DAG.
462
463 Returns an empty list if no cycle is found.
464
465 ``keys`` may be a single key or list of keys.
466
467 Examples
468 --------
469
470 >>> inc = lambda x: x + 1
471 >>> d = {'x': (inc, 'z'), 'y': (inc, 'x'), 'z': (inc, 'y')}
472 >>> getcycle(d, 'x')
473 ['x', 'z', 'y', 'x']
474
475 See Also
476 --------
477 isdag
478 """
479 return _toposort(d, keys=keys, returncycle=True)
480
481
482def isdag(d, keys):

Callers 3

orderFunction · 0.90
test_getcycleFunction · 0.90
isdagFunction · 0.85

Calls 1

_toposortFunction · 0.85

Tested by 1

test_getcycleFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…