degree_sequence#

Degree and neighborhood growth sequences for planar diagrams.

degree_sequence(k)#

Return the sorted degree sequence of all nodes.

Parameters:

k (PlanarDiagram) – Unoriented planar diagram.

Returns:

Tuple of node degrees in nondecreasing order.

Return type:

tuple[int, …]

neighbour_sequence(k, node)#

Return the BFS layer sizes starting from node.

This is the “neighbor sequence” used in canonicalization: perform a BFS from node and record how many new nodes appear at each distance.

Parameters:
  • k (PlanarDiagram) – Unoriented planar diagram.

  • node – Starting node.

Returns:

Tuple where the i-th entry is the number of nodes at distance i from node (i ≥ 1). The 0-th layer (the start) is not included.

Raises:

KeyError – If node is not present in the diagram.

Return type:

tuple[int, …]