和顺 / 势衡 返回所属 Agent
SH-04.01

依赖与反馈

原能力

梳理局部行动影响其他主体或阶段的路径,标记证据与假设。(细化版 p.8–9)

首选项目

NetworkX(BSD-3-Clause)。 NetworkX

匹配范围

有向图和流程图呈现节点、路径及环路。

源码

NetworkX · def simple_cycles(

networkx/algorithms/cycles.py · 106–119 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
def simple_cycles(G, length_bound=None):
    """Find simple cycles (elementary circuits) of a graph.

    A "simple cycle", or "elementary circuit", is a closed path where
    no node appears twice.  In a directed graph, two simple cycles are distinct
    if they are not cyclic permutations of each other.  In an undirected graph,
    two simple cycles are distinct if they are not cyclic permutations of each
    other nor of the other's reversal.

    Optionally, the cycles are bounded in length.  In the unbounded case, we use
    a nonrecursive, iterator/generator version of Johnson's algorithm [1]_.  In
    the bounded case, we use a version of the algorithm of Gupta and
    Suzumura [2]_. There may be better algorithms for some cases [3]_ [4]_ [5]_.

NetworkX · def add_edge(

networkx/classes/digraph.py · 676–689 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    def add_edge(self, u_of_edge, v_of_edge, **attr):
        """Add an edge between u and v.

        The nodes u and v will be automatically added if they are
        not already in the graph.

        Edge attributes can be specified with keywords or by directly
        accessing the edge's attribute dictionary. See examples below.

        Parameters
        ----------
        u_of_edge, v_of_edge : nodes
            Nodes can be, for example, strings or numbers.
            Nodes must be hashable (and not None) Python objects.

实现与验收要点

识别真实影响和反馈、保存证据及不确定方向。