On this page
  1. graphlib.CycleError
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

graphlib.CycleError

Up: graphlib | Next: graphlib.TopologicalSorter
Rel: graphlib.TopologicalSorter
Ref: docs.python.org โ€” graphlib.CycleError
Tags: #public #python3 #stdlib #graphlib


Import

import graphlib
from graphlib import CycleError

Signature & Overview

graphlib.CycleError(...)

Subclass of ValueError raised by TopologicalSorter.prepare if cycles exist in the working graph.

Methods & Attributes

Usage

import graphlib

ts = graphlib.TopologicalSorter({"a": ["b"], "b": ["a"]})
try:
    list(ts.static_order())
except graphlib.CycleError as exc:
    assert len(exc.args[1]) >= 2   # cycle path nodes

Gotchas

REPL Inspect

from graphlib import CycleError
help(CycleError)

Linked from

Related notes