... | ... |
@@ -111,38 +111,38 @@ |
111 | 111 |
void first(Node& node) const { |
112 | 112 |
node.id = first_node; |
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
void next(Node& node) const { |
116 | 116 |
node.id = nodes[node.id].next; |
117 | 117 |
} |
118 | 118 |
|
119 | 119 |
|
120 | 120 |
void first(Arc& arc) const { |
121 | 121 |
int n; |
122 | 122 |
for(n = first_node; |
123 |
n!=-1 && nodes[n]. |
|
123 |
n != -1 && nodes[n].first_out == -1; |
|
124 | 124 |
n = nodes[n].next) {} |
125 |
arc.id = (n == -1) ? -1 : nodes[n]. |
|
125 |
arc.id = (n == -1) ? -1 : nodes[n].first_out; |
|
126 | 126 |
} |
127 | 127 |
|
128 | 128 |
void next(Arc& arc) const { |
129 |
if (arcs[arc.id].next_in != -1) { |
|
130 |
arc.id = arcs[arc.id].next_in; |
|
129 |
if (arcs[arc.id].next_out != -1) { |
|
130 |
arc.id = arcs[arc.id].next_out; |
|
131 | 131 |
} else { |
132 | 132 |
int n; |
133 |
for(n = nodes[arcs[arc.id].target].next; |
|
134 |
n!=-1 && nodes[n].first_in == -1; |
|
133 |
for(n = nodes[arcs[arc.id].source].next; |
|
134 |
n != -1 && nodes[n].first_out == -1; |
|
135 | 135 |
n = nodes[n].next) {} |
136 |
arc.id = (n == -1) ? -1 : nodes[n]. |
|
136 |
arc.id = (n == -1) ? -1 : nodes[n].first_out; |
|
137 | 137 |
} |
138 | 138 |
} |
139 | 139 |
|
140 | 140 |
void firstOut(Arc &e, const Node& v) const { |
141 | 141 |
e.id = nodes[v.id].first_out; |
142 | 142 |
} |
143 | 143 |
void nextOut(Arc &e) const { |
144 | 144 |
e.id=arcs[e.id].next_out; |
145 | 145 |
} |
146 | 146 |
|
147 | 147 |
void firstIn(Arc &e, const Node& v) const { |
148 | 148 |
e.id = nodes[v.id].first_in; |
0 comments (0 inline)