is_bridge#

is_bridge(k: PlanarDiagram, arc_or_endpoint) bool#

Determine whether the given arc or endpoint is a bridge in the planar diagram.

A bridge is an arc whose removal disconnects the diagram into two disjoint components. This function checks if the provided arc_or_endpoint forms a cut set.

Args:

k (PlanarDiagram): The planar diagram. arc_or_endpoint (Union[Endpoint, set[Endpoint], frozenset[Endpoint]]):

The arc (set of two endpoints) or a single endpoint to check.

Returns:

bool: True if the arc or endpoint is a bridge, False otherwise.

Raises:

TypeError: If arc_or_endpoint is not an Endpoint or a set of endpoints.

Notes:
  • If an Endpoint is provided, its twin is included in the check.

  • If a set of endpoints is provided, the function evaluates whether their removal disconnects the diagram.