Re: Detecting a cycle in a graph

2018-01-15 Thread Frank Millman
"MRAB" wrote in message news:1f67363c-4d2a-f5ac-7fa8-b6690ddba...@mrabarnett.plus.com... On 2018-01-15 06:15, Frank Millman wrote: > I start my cycle-detection with a node with 0 incoming connections. > > def find_cycle(node, path): > for output in node.outputs: > if output in

Re: Detecting a cycle in a graph

2018-01-15 Thread MRAB
On 2018-01-15 06:15, Frank Millman wrote: "Christian Gollwitzer" wrote in message news:p3gh84$kfm$1...@dont-email.me... Am 14.01.18 um 22:04 schrieb Christian Gollwitzer: > Am 14.01.18 um 09:30 schrieb Frank Millman: >> I need to detect when a 'cycle' occurs - when a path loops back on >>

Re: Detecting a cycle in a graph

2018-01-14 Thread Frank Millman
"Christian Gollwitzer" wrote in message news:p3gh84$kfm$1...@dont-email.me... Am 14.01.18 um 22:04 schrieb Christian Gollwitzer: > Am 14.01.18 um 09:30 schrieb Frank Millman: >> I need to detect when a 'cycle' occurs - when a path loops back on >> itself and revisits a node previously

Re: Detecting a cycle in a graph

2018-01-14 Thread Christian Gollwitzer
Am 14.01.18 um 22:04 schrieb Christian Gollwitzer: Am 14.01.18 um 09:30 schrieb Frank Millman: I need to detect when a 'cycle' occurs - when a path loops back on itself and revisits a node previously visited. I have figured out a way to do this, but I have a problem. I don't know if that

Re: Detecting a cycle in a graph

2018-01-14 Thread Christian Gollwitzer
Am 14.01.18 um 09:30 schrieb Frank Millman: I need to detect when a 'cycle' occurs - when a path loops back on itself and revisits a node previously visited. I have figured out a way to do this, but I have a problem. I don't know if that helps, but there is a classic graph theory algorithm

Re: Detecting a cycle in a graph

2018-01-14 Thread Frank Millman
"Steven D'Aprano" wrote in message news:p3f9uh$ar4$1...@blaine.gmane.org... On Sun, 14 Jan 2018 10:30:31 +0200, Frank Millman wrote: > I can detect a cycle in a path. It is possible for there to be more than > one gateway in the path. I want to identify the gateway that actually > triggered

Re: Detecting a cycle in a graph

2018-01-14 Thread Steven D'Aprano
On Sun, 14 Jan 2018 10:30:31 +0200, Frank Millman wrote: > I can detect a cycle in a path. It is possible for there to be more than > one gateway in the path. I want to identify the gateway that actually > triggered the cycle, but I have not figured out a way to do this. You don't need a gateway

Detecting a cycle in a graph

2018-01-14 Thread Frank Millman
Hi all I am adding a bpm (Business Process Management) module to my accounting app. A process is laid out as a flowchart, and is therefore a form of directed graph, so I am getting into a bit of graph theory. I got some good ideas from this essay - https://www.python.org/doc/essays/graphs/