Changeset 986:e997802b855c in lemon-0.x for src/work/athos
- Timestamp:
- 11/13/04 13:53:28 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1376
- Location:
- src/work/athos
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/athos/bfs_test.cc
r921 r986 42 42 OutEdgeIt e; 43 43 for(g.first(e,v); g.valid(e); g.next(e)) { 44 Node w=g. head(e);44 Node w=g.target(e); 45 45 if (!reached[w]) { 46 46 bfs_queue.push(w); -
src/work/athos/dijkstra_demo.cc
r921 r986 130 130 std::cout << "out edges: "; 131 131 for(out_edge_iterator j=flow_test.first_out_edge(i); j.valid(); ++j) 132 std::cout << node_name.get(flow_test. tail(j)) << "-"<< cap.get(j) << "->" << node_name.get(flow_test.head(j)) << " ";132 std::cout << node_name.get(flow_test.source(j)) << "-"<< cap.get(j) << "->" << node_name.get(flow_test.target(j)) << " "; 133 133 std::cout << "in edges: "; 134 134 for(in_edge_iterator j=flow_test.first_in_edge(i); j.valid(); ++j) 135 std::cout << node_name.get(flow_test. tail(j)) << "-"<< cap.get(j) << "->" << node_name.get(flow_test.head(j)) << " ";135 std::cout << node_name.get(flow_test.source(j)) << "-"<< cap.get(j) << "->" << node_name.get(flow_test.target(j)) << " "; 136 136 std::cout << std::endl; 137 137 } -
src/work/athos/mincostflow.h
r921 r986 74 74 ValueType operator[](typename ResGraph::Edge e) const { 75 75 if (res_graph.forward(e)) 76 return ol[e]-(pot[res_graph. head(e)]-pot[res_graph.tail(e)]);76 return ol[e]-(pot[res_graph.target(e)]-pot[res_graph.source(e)]); 77 77 else 78 return -ol[e]-(pot[res_graph. head(e)]-pot[res_graph.tail(e)]);78 return -ol[e]-(pot[res_graph.target(e)]-pot[res_graph.source(e)]); 79 79 } 80 80 … … 259 259 while ( i != nonabundant_arcs.end() ){ 260 260 if (flow[*i]>=buf){ 261 Node a = abundant_components.find(res_graph. head(*i));262 Node b = abundant_components.find(res_graph. tail(*i));261 Node a = abundant_components.find(res_graph.target(*i)); 262 Node b = abundant_components.find(res_graph.source(*i)); 263 263 //Merge 264 264 if (a != b){ … … 285 285 while (n!=non_root){ 286 286 e = bfs_pred[n]; 287 n = res_graph. tail(e);287 n = res_graph.source(e); 288 288 res_graph.augment(e,qty_to_augment); 289 289 } … … 455 455 FOR_EACH_LOC(typename Graph::EdgeIt, e, graph){ 456 456 //C^{\Pi}_{i,j} 457 mod_pot = cost[e]-potential[graph. head(e)]+potential[graph.tail(e)];457 mod_pot = cost[e]-potential[graph.target(e)]+potential[graph.source(e)]; 458 458 fl_e = flow[e]; 459 459 // std::cout << fl_e << std::endl; … … 484 484 return false; 485 485 } 486 supdem[graph. tail(e)] += flow[e];487 supdem[graph. head(e)] -= flow[e];486 supdem[graph.source(e)] += flow[e]; 487 supdem[graph.target(e)] -= flow[e]; 488 488 } 489 489 //write_property_vector(supdem, "supdem"); -
src/work/athos/old/minlengthpaths.h
r921 r986 54 54 55 55 ValueType operator[](typename ResGraphType::Edge e) const { 56 //if ( (1-2*rev[e])*ol[e]-(pot[G. head(e)]-pot[G.tail(e)] ) <0 ){56 //if ( (1-2*rev[e])*ol[e]-(pot[G.target(e)]-pot[G.source(e)] ) <0 ){ 57 57 // std::cout<<"Negative length!!"<<std::endl; 58 58 //} 59 return (1-2*rev[e])*ol[e]-(pot[G. head(e)]-pot[G.tail(e)]);59 return (1-2*rev[e])*ol[e]-(pot[G.target(e)]-pot[G.source(e)]); 60 60 } 61 61 … … 162 162 G.next(e); 163 163 } 164 n = G. head(e);164 n = G.target(e); 165 165 paths[j].push_back(e); 166 166 total_length += length[e]; -
src/work/athos/preflow_push_wogw.h
r921 r986 140 140 //This private procedure is supposed to modify the preflow on edge j 141 141 //by value v (which can be positive or negative as well) 142 //and maintain the excess on the head and tail142 //and maintain the excess on the target and source 143 143 //Here we do not check whether this is possible or not 144 144 void modify_preflow(Edge j, const T& v){ … … 148 148 149 149 150 //Modifiyng the head151 modify_excess(G. head(j),v);152 153 //Modifiyng the tail154 modify_excess(G. tail(j),-v);150 //Modifiyng the target 151 modify_excess(G.target(j),v); 152 153 //Modifiyng the source 154 modify_excess(G.source(j),-v); 155 155 156 156 } … … 273 273 InEdgeIt e; 274 274 for(G.first(e,v); G.valid(e); G.next(e)) { 275 Node w=G. tail(e);275 Node w=G.source(e); 276 276 if ( level[w] == number_of_nodes && w != s ) { 277 277 bfs_queue.push(w); … … 311 311 for(OutEdgeIt j=G.template first<OutEdgeIt>(s); G.valid(j); G.next(j)){ 312 312 modify_preflow(j,capacity[j] ); 313 make_active(G. head(j));314 int lev=level[G. head(j)];313 make_active(G.target(j)); 314 int lev=level[G.target(j)]; 315 315 if(highest_active<lev){ 316 316 highest_active=lev; … … 326 326 327 327 if (capacity[j]>preflow[j]){ 328 if(level[G. tail(j)]==level[G.head(j)]+1){328 if(level[G.source(j)]==level[G.target(j)]+1){ 329 329 return true; 330 330 } 331 331 else{ 332 if (level[G. head(j)] < new_level)333 new_level=level[G. head(j)];332 if (level[G.target(j)] < new_level) 333 new_level=level[G.target(j)]; 334 334 } 335 335 } … … 342 342 343 343 if (0<preflow[j]){ 344 if(level[G. tail(j)]==level[G.head(j)]-1){344 if(level[G.source(j)]==level[G.target(j)]-1){ 345 345 346 346 return true; 347 347 } 348 348 else{ 349 if (level[G. tail(j)] < new_level)350 new_level=level[G. tail(j)];349 if (level[G.source(j)] < new_level) 350 new_level=level[G.source(j)]; 351 351 } 352 352 … … 389 389 e -= v; 390 390 //New node might become active 391 if (excess[G. head(j)]==0){392 make_active(G. head(j));391 if (excess[G.target(j)]==0){ 392 make_active(G.target(j)); 393 393 } 394 394 modify_preflow(j,v); … … 405 405 e -= v; 406 406 //New node might become active 407 if (excess[G. tail(j)]==0){408 make_active(G. tail(j));407 if (excess[G.source(j)]==0){ 408 make_active(G.source(j)); 409 409 } 410 410 modify_preflow(j,-v);
Note: See TracChangeset
for help on using the changeset viewer.