TopologicalSet

class lsst.daf.butler.core.utils.TopologicalSet(elements)

Bases: collections.abc.Set

A collection that behaves like a builtin set, but where elements can be interconnected (like a graph).

Iteration over this collection visits its elements in topologically sorted order.

Parameters:
elements : Iterable

Any iterable with elements to insert.

Methods Summary

connect(sourceElement, targetElement) Connect two elements in the set.
isdisjoint(other) Return True if two sets have a null intersection.

Methods Documentation

connect(sourceElement, targetElement)

Connect two elements in the set.

The connection is directed from sourceElement to targetElement and is distinct from its inverse. Both elements must already be present in the set.

sourceElement : object
The source element.
targetElement : object
The target element.
Raises:
KeyError

When either element is not already in the set.

ValueError

If a self connections between elements would be created.

isdisjoint(other)

Return True if two sets have a null intersection.