From ae06cb361b07ed024d38e8bf8ec37809c2c42dc2 Mon Sep 17 00:00:00 2001 From: josch Date: Tue, 3 Jul 2012 20:45:41 +0200 Subject: [PATCH] initial commit --- cycles.py | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 cycles.py diff --git a/cycles.py b/cycles.py new file mode 100644 index 0000000..721eb2e --- /dev/null +++ b/cycles.py @@ -0,0 +1,107 @@ +""" +R. Tarjan, Enumeration of the elementary circuits of a directed graph, SIAM Journal on Computing, 2 (1973), pp. 211-216 + +procedure circuit_enumeration; + begin + procedure BACKTRACK(integer value v, logical result f); + begin + logical g; + f := false; + place v on point stack; + mark(v) := true; + place v on marked stack; + for w in A(v) do + if w