topology#
Functions
|
Return the set of bridges (arcs whose removal disconnects the diagram) using a fast face-based test. |
|
Return ordered strands (“edges”) of the diagram. |
|
Return True if the given arc/endpoint is a bridge (a size-1 arc cut-set). |
Return True if the diagram has no nodes. |
|
|
Return True if endpoint forms a kink at a crossing (CCW neighbor is itself). |
|
Return True if all nodes are crossings and the diagram has a single link component. |
|
Return True if the diagram is a (multi)-knotoid (exactly two degree-1 vertices, rest crossings). |
|
Return True if node is a degree-1 vertex. |
|
Return True if all nodes are crossings (possibly multiple components). |
|
Return True if the diagram is a multi-linkoid (even number of leaf vertices; others crossings). |
|
Return True if an arc/endpoint forms a loop (an arc whose ends are on the same node which is a Vertex). |
Return True if all nodes are vertices (no crossings). |
|
|
Return True if the diagram is a single unknot component. |
|
Return True if the diagram is empty or all nodes are unknots (isolated looped vertices). |
|
Yield singleton “regions” (lists with one endpoint) representing kinks at crossings. |
|
Return the set of kink endpoints; optionally restrict to a given crossing. |
|
Return the set of degree-1 vertices. |
|
Return a list of arcs (each a 2-endpoint container) that are loops. |
Return the number of degree-2 looped vertices (unknots). |
|
|
Return a partition of endpoints into sets that belong to the same overstrand. |
|
Follow a strand starting at endpoint until reaching a vertex (or a cycle closes). |
- is_unlink(k)#
Return True if the diagram is empty or all nodes are unknots (isolated looped vertices).
- Parameters:
k (PlanarDiagram)
- Return type:
bool
- is_unknot(k)#
Return True if the diagram is a single unknot component.
- Parameters:
k (PlanarDiagram)
- Return type:
bool
- number_of_unknots(k)#
Return the number of degree-2 looped vertices (unknots).
- Parameters:
k (PlanarDiagram)
- Return type:
int
- is_knot(k)#
Return True if all nodes are crossings and the diagram has a single link component.
- Parameters:
k (PlanarDiagram)
- Return type:
bool
- is_link(k)#
Return True if all nodes are crossings (possibly multiple components).
- Parameters:
k (PlanarDiagram)
- Return type:
bool
- is_planar_graph(k)#
Return True if all nodes are vertices (no crossings).
- Parameters:
k (PlanarDiagram)
- Return type:
bool
- is_empty_diagram(k)#
Return True if the diagram has no nodes.
- Parameters:
k (PlanarDiagram)
- Return type:
bool
- is_knotoid(k)#
Return True if the diagram is a (multi)-knotoid (exactly two degree-1 vertices, rest crossings).
- Parameters:
k (PlanarDiagram)
- Return type:
bool
- is_linkoid(k)#
Return True if the diagram is a multi-linkoid (even number of leaf vertices; others crossings).
- Parameters:
k (PlanarDiagram)
- Return type:
bool
- is_leaf(k, node)#
Return True if node is a degree-1 vertex.
- Parameters:
k (PlanarDiagram)
- Return type:
bool
- leafs(k)#
Return the set of degree-1 vertices.
- Parameters:
k (PlanarDiagram)
- Return type:
set
- is_loop(k, arc_or_endpoint)#
Return True if an arc/endpoint forms a loop (an arc whose ends are on the same node which is a Vertex).
- Parameters:
k (PlanarDiagram) – Diagram.
arc_or_endpoint – Either a single Endpoint or a 2-endpoint container (arc).
- Return type:
bool
Notes
“Kink” is a special loop notion at crossings; see is_kink.
- loops(k)#
Return a list of arcs (each a 2-endpoint container) that are loops.
- Parameters:
k (PlanarDiagram)
- Return type:
list
- is_kink(k, endpoint)#
Return True if endpoint forms a kink at a crossing (CCW neighbor is itself).
- Parameters:
k (PlanarDiagram)
endpoint (Endpoint)
- Return type:
bool
- kinks(k, crossing=None)#
Return the set of kink endpoints; optionally restrict to a given crossing.
- Parameters:
k (PlanarDiagram)
- Return type:
set
- kink_region_iterator(k, of_node=None)#
Yield singleton “regions” (lists with one endpoint) representing kinks at crossings.
- Parameters:
k (PlanarDiagram) – Diagram.
of_node – If given, only consider kinks attached to this node.
- bridges(k)#
Return the set of bridges (arcs whose removal disconnects the diagram) using a fast face-based test.
Note
This uses a face incidence heuristic (fast) which may not be valid for already disjoint diagrams. For a robust (but slower) cut-set test, use _is_arc_cut_set.
- Parameters:
k (PlanarDiagram)
- Return type:
set
- is_bridge(k, arc_or_endpoint)#
Return True if the given arc/endpoint is a bridge (a size-1 arc cut-set).
- Parameters:
k (PlanarDiagram) – Diagram.
arc_or_endpoint – Either an Endpoint (we test the arc with its twin) or a 2-endpoint container.
- Raises:
TypeError – if input is neither an Endpoint nor a 2-endpoint container.
- Return type:
bool
- edges(k, **endpoint_attributes)#
Return ordered strands (“edges”) of the diagram.
Each edge is a list of endpoints starting at a vertex (or forming a closed component) and proceeding through crossings as per path_from_endpoint. Endpoints can be filtered by attributes via keyword arguments (e.g., color=”red”).
- Parameters:
k (PlanarDiagram) – Diagram.
**endpoint_attributes – Attribute filters that all endpoints in a strand must satisfy.
- Returns:
List of strands, each a list of Endpoint.
- Return type:
list[list[Endpoint]]
- overstrands(k)#
Return a partition of endpoints into sets that belong to the same overstrand.
- Overstrand relation:
At each crossing, pair the two over-passing endpoints.
Along arcs, pair twins.
- Returns:
A list of sets (each set is an overstrand’s endpoints).
- Parameters: