Util Interface

class Timer

Simple timer that can be used as a context.

property duration: float

Duration for which the context was active.

assert_interval(name: str, value: numbers.Number, low: numbers.Number, high: numbers.Number, inclusive_low: bool = True, inclusive_high: bool = True) None

Assert that a value falls in a certain interval.

Parameters
  • name – Name of the variable for the error message.

  • value – Value to check.

  • low – Lower limit of the interval.

  • high – Upper limit of the interval.

  • inclusive_low – Whether the lower limit of the interval is inclusive.

  • inclusive_high – Whether the upper limit of the interval is inclusive.

Raises

ValueError – If the value does not fall in the interval.

patch_nx_graph()

Context for patching networkx.Graph and networkx.empty_graph() so they return Graph instances.

plot_graph(graph: cygraph.graph.Graph, seed: int = 0, ax=None) None

Plot a graph.

Parameters
  • graph – Graph to plot.

  • seed – Random number generator seed for the spring layout.