klao@308: // -*- c++ -*- klao@308: //#include klao@308: //#include klao@308: //#include klao@308: klao@308: #include klao@308: #include klao@308: klao@308: using namespace hugo; klao@308: klao@308: klao@308: int main() klao@308: { klao@308: klao@308: klao@308: typedef ListGraph::Node Node; klao@308: typedef ListGraph::Edge Edge; klao@308: klao@308: ListGraph graph; klao@308: klao@308: /* klao@308: //Marci példája klao@308: klao@308: klao@308: NodeIt s=graph.addNode(); klao@308: NodeIt v1=graph.addNode(); klao@308: NodeIt v2=graph.addNode(); klao@308: NodeIt v3=graph.addNode(); klao@308: NodeIt v4=graph.addNode(); klao@308: NodeIt t=graph.addNode(); klao@308: klao@308: klao@308: EdgeIt s_v1=graph.addEdge(s, v1); klao@308: EdgeIt s_v2=graph.addEdge(s, v2); klao@308: EdgeIt v1_v2=graph.addEdge(v1, v2); klao@308: EdgeIt v2_v1=graph.addEdge(v2, v1); klao@308: EdgeIt v1_v3=graph.addEdge(v1, v3); klao@308: EdgeIt v3_v2=graph.addEdge(v3, v2); klao@308: EdgeIt v2_v4=graph.addEdge(v2, v4); klao@308: EdgeIt v4_v3=graph.addEdge(v4, v3); klao@308: EdgeIt v3_t=graph.addEdge(v3, t); klao@308: EdgeIt v4_t=graph.addEdge(v4, t); klao@308: klao@308: ListGraph::EdgeMap length(graph); klao@308: klao@308: length.set(s_v1, 16); klao@308: length.set(s_v2, 13); klao@308: length.set(v1_v2, 10); klao@308: length.set(v2_v1, 4); klao@308: length.set(v1_v3, 12); klao@308: length.set(v3_v2, 9); klao@308: length.set(v2_v4, 14); klao@308: length.set(v4_v3, 7); klao@308: length.set(v3_t, 20); klao@308: length.set(v4_t, 4); klao@308: */ klao@308: klao@308: klao@308: //Ahuja könyv példája klao@308: klao@308: Node s=graph.addNode(); klao@308: Node v2=graph.addNode(); klao@308: Node v3=graph.addNode(); klao@308: Node v4=graph.addNode(); klao@308: Node v5=graph.addNode(); klao@308: Node t=graph.addNode(); klao@308: klao@308: Edge s_v2=graph.addEdge(s, v2); klao@308: Edge s_v3=graph.addEdge(s, v3); klao@308: Edge v2_v4=graph.addEdge(v2, v4); klao@308: Edge v2_v5=graph.addEdge(v2, v5); klao@308: Edge v3_v5=graph.addEdge(v3, v5); klao@308: Edge v4_t=graph.addEdge(v4, t); klao@308: Edge v5_t=graph.addEdge(v5, t); klao@308: klao@308: //Kis modositas klao@308: //edge_iterator v2_s=graph.add_edge(v2, s); klao@308: klao@308: ListGraph::EdgeMap length(graph); klao@308: klao@308: length.set(s_v2, 10); klao@308: length.set(s_v3, 10); klao@308: length.set(v2_v4, 5); klao@308: length.set(v2_v5, 8); klao@308: length.set(v3_v5, 5); klao@308: length.set(v4_t, 8); klao@308: length.set(v5_t, 8); klao@308: klao@308: //Kis modositas klao@308: //length.put(v2_s, 100); klao@308: klao@308: klao@308: klao@308: klao@308: /*Egyszerű példa klao@308: NodeIt s=flow_test.add_node(); klao@308: NodeIt v1=flow_test.add_node(); klao@308: NodeIt v2=flow_test.add_node(); klao@308: NodeIt t=flow_test.add_node(); klao@308: klao@308: node_property_vector node_name(flow_test); klao@308: node_name.put(s, "s"); klao@308: node_name.put(v1, "v1"); klao@308: node_name.put(v2, "v2"); klao@308: node_name.put(t, "t"); klao@308: klao@308: edge_iterator s_v1=flow_test.add_edge(s, v1); klao@308: edge_iterator v1_v2=flow_test.add_edge(v1, v2); klao@308: edge_iterator v2_t=flow_test.add_edge(v2, t); klao@308: klao@308: edge_property_vector length(flow_test); klao@308: klao@308: length.put(s_v1, 16); klao@308: length.put(v1_v2, 10); klao@308: length.put(v2_t, 4); klao@308: */ klao@308: klao@308: std::cout << "Suurballe algorithm test..." << std::endl; klao@308: klao@308: klao@308: int k=3; klao@308: MinLengthPaths surb_test(graph, length); klao@308: std::cout << surb_test.run(s,t,k)<