src/demo/sub_graph_wrapper_demo.cc
changeset 1188 7e529047df1a
parent 932 ade3cdb9b45d
equal deleted inserted replaced
6:79a21989f3df 7:91c8545eefbe
    35   Node s, t;
    35   Node s, t;
    36   LengthMap length(g);
    36   LengthMap length(g);
    37 
    37 
    38   readDimacs(std::cin, g, length, s, t);
    38   readDimacs(std::cin, g, length, s, t);
    39 
    39 
    40   cout << "edges with lengths (of form id, tail--length->head): " << endl;
    40   cout << "edges with lengths (of form id, source--length->target): " << endl;
    41   for(EdgeIt e(g); e!=INVALID; ++e) 
    41   for(EdgeIt e(g); e!=INVALID; ++e) 
    42     cout << " " << g.id(e) << ", " << g.id(g.tail(e)) << "--" 
    42     cout << " " << g.id(e) << ", " << g.id(g.source(e)) << "--" 
    43 	 << length[e] << "->" << g.id(g.head(e)) << endl;
    43 	 << length[e] << "->" << g.id(g.target(e)) << endl;
    44 
    44 
    45   cout << "s: " << g.id(s) << " t: " << g.id(t) << endl;
    45   cout << "s: " << g.id(s) << " t: " << g.id(t) << endl;
    46 
    46 
    47   typedef Dijkstra<Graph, LengthMap> Dijkstra;
    47   typedef Dijkstra<Graph, LengthMap> Dijkstra;
    48   Dijkstra dijkstra(g, length);
    48   Dijkstra dijkstra(g, length);
    73   cout << "edges of the maximum number of edge-disjoint shortest s-t paths: " 
    73   cout << "edges of the maximum number of edge-disjoint shortest s-t paths: " 
    74        << endl;
    74        << endl;
    75   for(EdgeIt e(g); e!=INVALID; ++e) 
    75   for(EdgeIt e(g); e!=INVALID; ++e) 
    76     if (flow[e])
    76     if (flow[e])
    77       cout << " " << g.id(e) << ", "
    77       cout << " " << g.id(e) << ", "
    78 	   << g.id(g.tail(e)) << "--" 
    78 	   << g.id(g.source(e)) << "--" 
    79 	   << length[e] << "->" << g.id(g.head(e)) << endl;
    79 	   << length[e] << "->" << g.id(g.target(e)) << endl;
    80 }
    80 }