for int loops_nodes size This is the worst example of code this paints

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
for (int i=0; i<loops_nodes.size(); i++)
// This is the worst example of c++ code
// (this paints shortest cycle edges to red
{
if (loops_nodes[i].second==min)
{
for (int j=0; j<loops_nodes[i].first.size();j++)
{
loops_nodes[i].first[j]->color=Qt::red;
loops_nodes[i].first[j]->update();
}
for (int k=0; k<loops_nodes[i].first.size();k++)
{
for (int l=k; l<loops_nodes[i].first.size(); l++)
{
for (int e=0; e<loops_nodes[i].first[k]->edges.size(); e++)
{
if (
(
((Edge*)(loops_nodes[i].first[k]->edges[e]))->one
==loops_nodes[i].first[k]
&&
((Edge*)(loops_nodes[i].first[k]->edges[e]))->two
==loops_nodes[i].first[l]
)
||
(
((Edge*)(loops_nodes[i].first[k]->edges[e]))->two
==loops_nodes[i].first[k]
&&
((Edge*)(loops_nodes[i].first[k]->edges[e]))->one
==loops_nodes[i].first[l]
)
)
{
((Edge*)(loops_nodes[i].first[k]->edges[e]))->color
=Qt::red;
loops_nodes[i].first[k]->edges[e]->update();
}
}
}
}
break;
}
}