[Python] Finding starts, ends, and loops with pydot

Discussão em 'Python' iniciado por Stack, Maio 6, 2025.

  1. Stack

    Stack Membro Participativo

    Is there a way to achieve this in pydot?

    Take the following example:

    [Outputted Dot File]

    strict graph g{
    "A" -> "B";
    "B" -> "C";
    "C" -> "D";
    "D" -> "E";
    }


    [Python]

    print(num.start)
    >>> A
    print(num.steps)
    >>> ["a,b","b,c","c,d","d,e"]
    print(num.end)
    >>> E


    or with the following case:

    [Outputted Dot File]

    strict graph g{
    "A" -> "B";
    "B" -> "C";
    "C" -> "A";
    }


    [Python]

    if num["A"] == num.loop:
    print("[%s] loop detected")%(num["A"])

    Continue reading...

Compartilhe esta Página