aboutsummaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
authorMaximilian Szengel <gnunet@maxsz.de>2012-10-07 13:41:40 +0000
committerMaximilian Szengel <gnunet@maxsz.de>2012-10-07 13:41:40 +0000
commit605c3946e573ab1446e8210b3b7f6cccd5c1ba03 (patch)
tree44b9fd066888e15a475a93d77e09ad3851bb927d /src/regex
parentc5606aeaf94c0917ffd3258e7274cd901a2822c8 (diff)
downloadgnunet-605c3946e573ab1446e8210b3b7f6cccd5c1ba03.tar.gz
gnunet-605c3946e573ab1446e8210b3b7f6cccd5c1ba03.zip
fix
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/regex_graph.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/regex/regex_graph.c b/src/regex/regex_graph.c
index 483cef698..0b5c571eb 100644
--- a/src/regex/regex_graph.c
+++ b/src/regex/regex_graph.c
@@ -88,26 +88,20 @@ scc_tarjan_strongconnect (unsigned int *scc_counter,
88 scc_tarjan_strongconnect (scc_counter, w, index, stack, stack_size); 88 scc_tarjan_strongconnect (scc_counter, w, index, stack, stack_size);
89 v->lowlink = (v->lowlink > w->lowlink) ? w->lowlink : v->lowlink; 89 v->lowlink = (v->lowlink > w->lowlink) ? w->lowlink : v->lowlink;
90 } 90 }
91 else if (0 != w->contained) 91 else if (1 == w->contained)
92 v->lowlink = (v->lowlink > w->index) ? w->index : v->lowlink; 92 v->lowlink = (v->lowlink > w->index) ? w->index : v->lowlink;
93 } 93 }
94 94
95 if (v->lowlink == v->index) 95 if (v->lowlink == v->index)
96 { 96 {
97 w = stack[--(*stack_size)]; 97 (*scc_counter)++;
98 w->contained = 0; 98 do
99
100 if (v != w)
101 { 99 {
102 (*scc_counter)++; 100 w = stack[--(*stack_size)];
103 while (v != w) 101 w->contained = 0;
104 {
105 w->scc_id = *scc_counter;
106 w = stack[--(*stack_size)];
107 w->contained = 0;
108 }
109 w->scc_id = *scc_counter; 102 w->scc_id = *scc_counter;
110 } 103 }
104 while (w != v);
111 } 105 }
112} 106}
113 107
@@ -178,7 +172,7 @@ GNUNET_REGEX_automaton_save_graph_step (void *cls, unsigned int count,
178 { 172 {
179 GNUNET_asprintf (&s_acc, 173 GNUNET_asprintf (&s_acc,
180 "\"%s\" [shape=doublecircle, color=\"0.%i 0.8 0.95\"];\n", 174 "\"%s\" [shape=doublecircle, color=\"0.%i 0.8 0.95\"];\n",
181 name, s->scc_id); 175 name, s->scc_id * s->scc_id);
182 } 176 }
183 else 177 else
184 { 178 {
@@ -190,7 +184,7 @@ GNUNET_REGEX_automaton_save_graph_step (void *cls, unsigned int count,
190 { 184 {
191 GNUNET_asprintf (&s_acc, 185 GNUNET_asprintf (&s_acc,
192 "\"%s\" [shape=circle, color=\"0.%i 0.8 0.95\"];\n", name, 186 "\"%s\" [shape=circle, color=\"0.%i 0.8 0.95\"];\n", name,
193 s->scc_id); 187 s->scc_id * s->scc_id);
194 } 188 }
195 else 189 else
196 { 190 {
@@ -228,7 +222,7 @@ GNUNET_REGEX_automaton_save_graph_step (void *cls, unsigned int count,
228 { 222 {
229 GNUNET_asprintf (&s_tran, 223 GNUNET_asprintf (&s_tran,
230 "\"%s\" -> \"%s\" [label = \"ε\", color=\"0.%i 0.8 0.95\"];\n", 224 "\"%s\" -> \"%s\" [label = \"ε\", color=\"0.%i 0.8 0.95\"];\n",
231 name, to_name, s->scc_id); 225 name, to_name, s->scc_id * s->scc_id);
232 } 226 }
233 else 227 else
234 { 228 {
@@ -242,7 +236,7 @@ GNUNET_REGEX_automaton_save_graph_step (void *cls, unsigned int count,
242 { 236 {
243 GNUNET_asprintf (&s_tran, 237 GNUNET_asprintf (&s_tran,
244 "\"%s\" -> \"%s\" [label = \"%s\", color=\"0.%i 0.8 0.95\"];\n", 238 "\"%s\" -> \"%s\" [label = \"%s\", color=\"0.%i 0.8 0.95\"];\n",
245 name, to_name, ctran->label, s->scc_id); 239 name, to_name, ctran->label, s->scc_id * s->scc_id);
246 } 240 }
247 else 241 else
248 { 242 {