rustworkx.simple_cycles#
- simple_cycles(graph, /)#
查找
PyDiGraph的所有简单周期一个“简单环”(在 [1] 中称为初等回路)指的是没有节点出现超过一次的环(或闭合路径)。
本函数实现了Johnson算法 [1],同时借鉴了NetworkX中的非递归实现版本。[2][3]
[1] https://doi.org/10.1137/0204007 [2] https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.cycles.simple_cycles.html [3] https://github.com/networkx/networkx/blob/networkx-2.8.4/networkx/algorithms/cycles.py#L98-L222