MCPcopy Create free account
hub / github.com/gonum/plot / circuit

Method circuit

plotter/johnson.go:72–104  ·  view source on GitHub ↗

circuit is the CIRCUIT sub-procedure in the paper.

(v int)

Source from the content-addressed store, hash-verified

70
71// circuit is the CIRCUIT sub-procedure in the paper.
72func (j *johnson) circuit(v int) bool {
73 f := false
74 j.stack = append(j.stack, v)
75 j.blocked[v] = true
76
77 //L1:
78 for w := range j.adjacent[v] {
79 if w == j.s {
80 // Output circuit composed of stack followed by s.
81 r := make([]int, len(j.stack)+1)
82 copy(r, j.stack)
83 r[len(r)-1] = j.s
84 j.result = append(j.result, r)
85 f = true
86 } else if !j.blocked[w] {
87 if j.circuit(w) {
88 f = true
89 }
90 }
91 }
92
93 //L2:
94 if f {
95 j.unblock(v)
96 } else {
97 for w := range j.adjacent[v] {
98 j.b[w][v] = struct{}{}
99 }
100 }
101 j.stack = j.stack[:len(j.stack)-1]
102
103 return f
104}
105
106// unblock is the UNBLOCK sub-procedure in the paper.
107func (j *johnson) unblock(u int) {

Callers 1

cyclesInFunction · 0.95

Calls 1

unblockMethod · 0.95

Tested by

no test coverage detected