src/work/athos/pf_demo.cc
changeset 212 c07e4dd32438
parent 105 a3c73e9b9b2e
child 331 f5461f8bc59b
equal deleted inserted replaced
2:889841e6a9c6 3:dea3093d5bd0
    21   typedef ListGraph::EachEdgeIt EachEdgeIt;
    21   typedef ListGraph::EachEdgeIt EachEdgeIt;
    22   typedef ListGraph::OutEdgeIt OutEdgeIt;
    22   typedef ListGraph::OutEdgeIt OutEdgeIt;
    23   typedef ListGraph::InEdgeIt InEdgeIt;
    23   typedef ListGraph::InEdgeIt InEdgeIt;
    24   typedef ListGraph::SymEdgeIt SymEdgeIt;
    24   typedef ListGraph::SymEdgeIt SymEdgeIt;
    25   */
    25   */
    26   
    26   ListGraph flowG;
       
    27 
       
    28   /*
    27   //Marci példája
    29   //Marci példája
    28   ListGraph flowG;
    30 
    29 
    31 
    30   NodeIt s=flowG.addNode();
    32   NodeIt s=flowG.addNode();
    31   NodeIt v1=flowG.addNode();
    33   NodeIt v1=flowG.addNode();
    32   NodeIt v2=flowG.addNode();
    34   NodeIt v2=flowG.addNode();
    33   NodeIt v3=flowG.addNode();
    35   NodeIt v3=flowG.addNode();
    56   cap.set(v3_v2, 9);
    58   cap.set(v3_v2, 9);
    57   cap.set(v2_v4, 14);
    59   cap.set(v2_v4, 14);
    58   cap.set(v4_v3, 7);
    60   cap.set(v4_v3, 7);
    59   cap.set(v3_t, 20);
    61   cap.set(v3_t, 20);
    60   cap.set(v4_t, 4);
    62   cap.set(v4_t, 4);
       
    63   */
    61 
    64 
    62 
    65 
       
    66   //Ahuja könyv példája
    63 
    67 
       
    68   NodeIt s=flowG.addNode();
       
    69   NodeIt v2=flowG.addNode();
       
    70   NodeIt v3=flowG.addNode();
       
    71   NodeIt v4=flowG.addNode();
       
    72   NodeIt v5=flowG.addNode();
       
    73   NodeIt t=flowG.addNode();
    64 
    74 
    65 
    75   EdgeIt s_v2=flowG.addEdge(s, v2);
    66 
    76   EdgeIt s_v3=flowG.addEdge(s, v3);
    67 
    77   EdgeIt v2_v4=flowG.addEdge(v2, v4);
    68   /*
    78   EdgeIt v2_v5=flowG.addEdge(v2, v5);
    69   //Ahuja könyv példája
    79   EdgeIt v3_v5=flowG.addEdge(v3, v5);
    70   node_iterator s=flow_test.add_node();
    80   EdgeIt v4_t=flowG.addEdge(v4, t);
    71   NodeIt v2=flow_test.add_node();
    81   EdgeIt v5_t=flowG.addEdge(v5, t);
    72   NodeIt v3=flow_test.add_node();
       
    73   NodeIt v4=flow_test.add_node();
       
    74   NodeIt v5=flow_test.add_node();
       
    75   NodeIt t=flow_test.add_node();
       
    76   
       
    77   node_property_vector<list_graph, std::string> node_name(flow_test);
       
    78   node_name.put(s, "s");  
       
    79   node_name.put(v2, "v2");
       
    80   node_name.put(v3, "v3");
       
    81   node_name.put(v4, "v4");
       
    82   node_name.put(v5, "v5");
       
    83   node_name.put(t, "t");
       
    84 
       
    85   
       
    86   edge_iterator s_v2=flow_test.add_edge(s, v2);
       
    87   edge_iterator s_v3=flow_test.add_edge(s, v3);
       
    88   
       
    89   edge_iterator v2_v4=flow_test.add_edge(v2, v4);
       
    90   edge_iterator v2_v5=flow_test.add_edge(v2, v5);
       
    91 
       
    92   edge_iterator v3_v5=flow_test.add_edge(v3, v5);
       
    93 
       
    94   edge_iterator v4_t=flow_test.add_edge(v4, t);
       
    95   edge_iterator v5_t=flow_test.add_edge(v5, t);
       
    96   
    82   
    97   //Kis modositas
    83   //Kis modositas
    98   edge_iterator v2_s=flow_test.add_edge(v2, s);
    84   //edge_iterator v2_s=flowG.add_edge(v2, s);
    99 
    85 
   100   edge_property_vector<list_graph, int> cap(flow_test);  
    86   ListGraph::EdgeMap<int> cap(flowG);
   101   cap.put(s_v2, 10);
    87 
   102   cap.put(s_v3, 10);
    88   cap.set(s_v2, 10);
   103   cap.put(v2_v4, 5);
    89   cap.set(s_v3, 10);
   104   cap.put(v2_v5, 8);
    90   cap.set(v2_v4, 5);
   105   cap.put(v3_v5, 5);
    91   cap.set(v2_v5, 8);
   106   cap.put(v4_t, 8);
    92   cap.set(v3_v5, 5);
   107   cap.put(v5_t, 8);
    93   cap.set(v4_t, 8);
       
    94   cap.set(v5_t, 8);
   108 
    95 
   109   //Kis modositas
    96   //Kis modositas
   110   cap.put(v2_s, 100);
    97   //cap.put(v2_s, 100);
   111 
    98  
   112   //Kis modositas
       
   113   //edge_iterator t_s=flow_test.add_edge(t, s);
       
   114   //cap.put(t_s, 20);
       
   115 
       
   116   */
       
   117 
    99 
   118 
   100 
   119 
   101 
   120   /*Egyszerű példa
   102   /*Egyszerű példa
   121   NodeIt s=flow_test.add_node();
   103   NodeIt s=flow_test.add_node();