_sink = &_vertices[sink];
for(int e = 0; e < nb_edges; e++) {
- _vertices[vertex_from[e]].add_leaving_edge(_edges + e);
+ _vertices[vertex_from[e]].add_leaving_edge(&_edges[e]);
_edges[e].occupied = 0;
- _edges[e].origin_vertex = _vertices + vertex_from[e];
- _edges[e].terminal_vertex = _vertices + vertex_to[e];
+ _edges[e].origin_vertex = &_vertices[vertex_from[e]];
+ _edges[e].terminal_vertex = &_vertices[vertex_to[e]];
}
for(int v = 0; v < _nb_vertices; v++) {
}
for(int k = 0; k < _nb_vertices; k++) {
- v = _vertices + k;
+ v = &_vertices[k];
for(e = v->leaving_edge_list_root; e; e = e->next_leaving_edge) {
tv = int(e->terminal_vertex - _vertices);
nb_predecessors[tv]++;
while(nb_without_predecessor > 0) {
new_nb_without_predecessor = 0;
for(int l = 0; l < nb_without_predecessor; l++) {
- v = _vertices + without_predecessor[l];
+ v = &_vertices[without_predecessor[l]];
v->distance_from_source = rank;
for(e = v->leaving_edge_list_root; e; e = e->next_leaving_edge) {
tv = int(e->terminal_vertex - _vertices);
void MTPGraph::print(ostream *os) {
for(int k = 0; k < _nb_edges; k++) {
- Edge *e = _edges + k;
+ Edge *e = &_edges[k];
(*os) << e->origin_vertex - _vertices
<< " -> "
<< e->terminal_vertex - _vertices
(*os) << " " << _source - _vertices << " [peripheries=2];" << endl;
(*os) << " " << _sink - _vertices << " [peripheries=2];" << endl;
for(int k = 0; k < _nb_edges; k++) {
- Edge *e = _edges + k;
+ Edge *e = &_edges[k];
(*os) << " "
<< e->origin_vertex - _vertices
<< " -> "
void MTPGraph::update_positivized_lengths() {
for(int k = 0; k < _nb_edges; k++) {
- Edge *e = _edges + k;
+ Edge *e = &_edges[k];
e->positivized_length +=
e->origin_vertex->distance_from_source - e->terminal_vertex->distance_from_source;
}
scalar_t max_error = 0.0;
#endif
for(int k = 0; k < _nb_edges; k++) {
- Edge *e = _edges + k;
+ Edge *e = &_edges[k];
if(e->positivized_length < 0) {
#ifdef VERBOSE
// Put back the graph in its original state (i.e. invert edges which
// have been inverted in the process)
for(int k = 0; k < _nb_edges; k++) {
- e = _edges + k;
+ e = &_edges[k];
if(e->occupied) { e->invert(); }
}
}