mooonpy.molspace.graph_theory.ring_analysis module

This module provides basic support for finding cycles/rings in an undirected graph.

mooonpy.molspace.graph_theory.ring_analysis.find_rings(graph: dict[int, list[int]], ring_sizes: tuple[int] = (3, 4, 5, 6, 7))[source]

Finds all cycles/rings in a graph that are specified in the ring_sizes parameter.

Note

Each ring will be sorted in the order it was traversed in the graph and will be in the canonical form (e.g., canonical=(1,2,3) vs non_canonical=(2,3,1)).

Parameters:
  • graph (dict[int, list[int]]) – An undirected graph

  • ring_sizes (tuple[int]) – Tuple containing ring sizes to search for in graph

Returns:

rings

Return type:

list[tuple[int]]