diff -r ee5959aa4410 -r c280de819a73 src/work/athos/dijkstra_demo.cc --- a/src/work/athos/dijkstra_demo.cc Sun Apr 17 18:57:22 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -#include -#include - -#include "list_graph.hh" -//#include "marci_property_vector.hh" -#include - -using namespace lemon; - - -int main (int, char*[]) -{ - - - typedef ListGraph::NodeIt NodeIt; - typedef ListGraph::EdgeIt EdgeIt; - /* - typedef ListGraph::EachNodeIt EachNodeIt; - typedef ListGraph::EachEdgeIt EachEdgeIt; - typedef ListGraph::OutEdgeIt OutEdgeIt; - typedef ListGraph::InEdgeIt InEdgeIt; - typedef ListGraph::SymEdgeIt SymEdgeIt; - */ - ListGraph flowG; - - /* - //Marci példája - - - NodeIt s=flowG.addNode(); - NodeIt v1=flowG.addNode(); - NodeIt v2=flowG.addNode(); - NodeIt v3=flowG.addNode(); - NodeIt v4=flowG.addNode(); - NodeIt t=flowG.addNode(); - - - EdgeIt s_v1=flowG.addEdge(s, v1); - EdgeIt s_v2=flowG.addEdge(s, v2); - EdgeIt v1_v2=flowG.addEdge(v1, v2); - EdgeIt v2_v1=flowG.addEdge(v2, v1); - EdgeIt v1_v3=flowG.addEdge(v1, v3); - EdgeIt v3_v2=flowG.addEdge(v3, v2); - EdgeIt v2_v4=flowG.addEdge(v2, v4); - EdgeIt v4_v3=flowG.addEdge(v4, v3); - EdgeIt v3_t=flowG.addEdge(v3, t); - EdgeIt v4_t=flowG.addEdge(v4, t); - - ListGraph::EdgeMap cap(flowG); - - cap.set(s_v1, 16); - cap.set(s_v2, 13); - cap.set(v1_v2, 10); - cap.set(v2_v1, 4); - cap.set(v1_v3, 12); - cap.set(v3_v2, 9); - cap.set(v2_v4, 14); - cap.set(v4_v3, 7); - cap.set(v3_t, 20); - cap.set(v4_t, 4); - */ - - - //Ahuja könyv példája - - NodeIt s=flowG.addNode(); - NodeIt v2=flowG.addNode(); - NodeIt v3=flowG.addNode(); - NodeIt v4=flowG.addNode(); - NodeIt v5=flowG.addNode(); - NodeIt t=flowG.addNode(); - - EdgeIt s_v2=flowG.addEdge(s, v2); - EdgeIt s_v3=flowG.addEdge(s, v3); - EdgeIt v2_v4=flowG.addEdge(v2, v4); - EdgeIt v2_v5=flowG.addEdge(v2, v5); - EdgeIt v3_v5=flowG.addEdge(v3, v5); - EdgeIt v4_t=flowG.addEdge(v4, t); - EdgeIt v5_t=flowG.addEdge(v5, t); - - //Kis modositas - //edge_iterator v2_s=flowG.add_edge(v2, s); - - ListGraph::EdgeMap cap(flowG); - - cap.set(s_v2, 10); - cap.set(s_v3, 10); - cap.set(v2_v4, 5); - cap.set(v2_v5, 8); - cap.set(v3_v5, 5); - cap.set(v4_t, 8); - cap.set(v5_t, 8); - - //Kis modositas - //cap.put(v2_s, 100); - - - - - /*Egyszerű példa - NodeIt s=flow_test.add_node(); - NodeIt v1=flow_test.add_node(); - NodeIt v2=flow_test.add_node(); - NodeIt t=flow_test.add_node(); - - node_property_vector node_name(flow_test); - node_name.put(s, "s"); - node_name.put(v1, "v1"); - node_name.put(v2, "v2"); - node_name.put(t, "t"); - - edge_iterator s_v1=flow_test.add_edge(s, v1); - edge_iterator v1_v2=flow_test.add_edge(v1, v2); - edge_iterator v2_t=flow_test.add_edge(v2, t); - - edge_property_vector cap(flow_test); - - cap.put(s_v1, 16); - cap.put(v1_v2, 10); - cap.put(v2_t, 4); - */ - - std::cout << "preflow-push algorithm test..." << std::endl; - - /* - std::cout << "on directed graph graph" << std::endl; //<< flow_test; - std::cout << "names and capacity values" << std::endl; - for(EachNodeIt i=flow_test.first_node(); i.valid(); ++i) { - std::cout << node_name.get(i) << ": "; - std::cout << "out edges: "; - for(out_edge_iterator j=flow_test.first_out_edge(i); j.valid(); ++j) - std::cout << node_name.get(flow_test.source(j)) << "-"<< cap.get(j) << "->" << node_name.get(flow_test.target(j)) << " "; - std::cout << "in edges: "; - for(in_edge_iterator j=flow_test.first_in_edge(i); j.valid(); ++j) - std::cout << node_name.get(flow_test.source(j)) << "-"<< cap.get(j) << "->" << node_name.get(flow_test.target(j)) << " "; - std::cout << std::endl; - } - */ - - //for(each_NodeIt i=flow_test.first_node(); i.valid(); ++i) { - // std::cout << i << " "; - //} - - dijkstra_at dijkstra_test(flowG, s, cap); - //cout << preflow_push_test.run()<