athos@36: #include athos@36: #include athos@36: #include athos@36: athos@331: #include "list_graph.h" athos@331: //#include "marci_graph_traits.hh" athos@77: //#include "marci_property_vector.hh" athos@36: #include "preflow_push.hh" athos@36: alpar@105: using namespace hugo; athos@36: athos@36: athos@36: int main (int, char*[]) athos@36: { athos@36: athos@331: typedef ListGraph::Node Node; athos@331: typedef ListGraph::Edge Edge; athos@331: athos@331: ListGraph graph; athos@201: athos@201: /* athos@77: //Marci példája athos@201: athos@77: athos@331: NodeIt s=graph.addNode(); athos@331: NodeIt v1=graph.addNode(); athos@331: NodeIt v2=graph.addNode(); athos@331: NodeIt v3=graph.addNode(); athos@331: NodeIt v4=graph.addNode(); athos@331: NodeIt t=graph.addNode(); athos@77: athos@77: athos@331: EdgeIt s_v1=graph.addEdge(s, v1); athos@331: EdgeIt s_v2=graph.addEdge(s, v2); athos@331: EdgeIt v1_v2=graph.addEdge(v1, v2); athos@331: EdgeIt v2_v1=graph.addEdge(v2, v1); athos@331: EdgeIt v1_v3=graph.addEdge(v1, v3); athos@331: EdgeIt v3_v2=graph.addEdge(v3, v2); athos@331: EdgeIt v2_v4=graph.addEdge(v2, v4); athos@331: EdgeIt v4_v3=graph.addEdge(v4, v3); athos@331: EdgeIt v3_t=graph.addEdge(v3, t); athos@331: EdgeIt v4_t=graph.addEdge(v4, t); athos@77: athos@331: ListGraph::EdgeMap length(graph); athos@77: athos@331: length.set(s_v1, 16); athos@331: length.set(s_v2, 13); athos@331: length.set(v1_v2, 10); athos@331: length.set(v2_v1, 4); athos@331: length.set(v1_v3, 12); athos@331: length.set(v3_v2, 9); athos@331: length.set(v2_v4, 14); athos@331: length.set(v4_v3, 7); athos@331: length.set(v3_t, 20); athos@331: length.set(v4_t, 4); athos@201: */ athos@77: athos@77: athos@201: //Ahuja könyv példája athos@77: athos@331: Node s=graph.addNode(); athos@331: Node v2=graph.addNode(); athos@331: Node v3=graph.addNode(); athos@331: Node v4=graph.addNode(); athos@331: Node v5=graph.addNode(); athos@331: Node t=graph.addNode(); athos@77: athos@331: Edge s_v2=graph.addEdge(s, v2); athos@331: Edge s_v3=graph.addEdge(s, v3); athos@331: Edge v2_v4=graph.addEdge(v2, v4); athos@331: Edge v2_v5=graph.addEdge(v2, v5); athos@331: Edge v3_v5=graph.addEdge(v3, v5); athos@331: Edge v4_t=graph.addEdge(v4, t); athos@331: Edge v5_t=graph.addEdge(v5, t); athos@36: athos@36: //Kis modositas athos@331: //edge_iterator v2_s=graph.add_edge(v2, s); athos@36: athos@331: ListGraph::EdgeMap length(graph); athos@201: athos@331: length.set(s_v2, 10); athos@331: length.set(s_v3, 10); athos@331: length.set(v2_v4, 5); athos@331: length.set(v2_v5, 8); athos@331: length.set(v3_v5, 5); athos@331: length.set(v4_t, 8); athos@331: length.set(v5_t, 8); athos@36: athos@36: //Kis modositas athos@331: //length.put(v2_s, 100); athos@36: athos@77: athos@77: athos@36: std::cout << "preflow-push algorithm test..." << std::endl; athos@77: athos@36: athos@331: preflow_push preflow_push_test(graph, s, t, length); athos@36: cout << preflow_push_test.run()<