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