From 9245287c650370d70a142a6f749cd57314058d9b Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Wed, 27 Sep 2000 18:19:35 +0000 Subject: [PATCH] changed the argument order for MutableGraph to be consistent with the other functions. Also added the remove_edge(e, g) and remove_edge(iter, g) functions. [SVN r7856] --- docs/MutableGraph.html | 22 +- docs/adjacency_list.html | 84 ++- docs/connected_components.html | 28 +- docs/dynamic_connected_components.html | 8 +- docs/file_dependency_example.html | 2 +- docs/graph_concepts.html | 23 +- docs/kevin_bacon.html | 2 +- docs/quick_tour.html | 2 +- docs/transpose_graph.html | 2 +- docs/using_adjacency_list.html | 2 +- docs/using_boost_graph_library.html | 2 +- docs/using_property_maps.html | 6 +- examples/adjacency_list.cpp | 23 +- examples/adjacency_list.expected | 7 +- examples/bfs.cpp | 24 +- examples/concept_checks.cpp | 12 + examples/connected_components.cpp | 24 +- examples/cuthill_mckee_ordering.cpp | 2 +- examples/dave.cpp | 4 +- examples/dfs.cpp | 18 +- examples/dijkstra.cpp | 2 +- examples/dynamic_components.cpp | 8 +- examples/edge_basics.cpp | 2 +- examples/edge_property.cpp | 22 +- examples/exterior_edge_properties.cpp | 20 +- examples/exterior_property_map.cpp | 2 +- examples/family_tree.cpp | 12 +- examples/file_dependencies.cpp | 2 +- examples/graph.cpp | 12 +- examples/in_edges.cpp | 10 +- examples/interior_property_map.cpp | 2 +- examples/kevin_bacon.cpp | 2 +- examples/quick_tour.cpp | 2 +- examples/undirected.cpp | 6 +- examples/vertex_basics.cpp | 2 +- include/boost/graph/detail/adjacency_list.hpp | 647 ++++++++++++------ include/boost/graph/graph_concepts.hpp | 16 +- include/boost/graph/transpose_graph.hpp | 2 +- test/graph.cpp | 57 +- test/graph_type.hpp | 4 +- 40 files changed, 730 insertions(+), 399 deletions(-) diff --git a/docs/MutableGraph.html b/docs/MutableGraph.html index d288cb61..a3f3ef2b 100644 --- a/docs/MutableGraph.html +++ b/docs/MutableGraph.html @@ -61,7 +61,7 @@ edges and vertices. - + - + - + - + - + + + + + + @@ -288,23 +293,27 @@ number of edges in the graph. +clear_vertex(v, g) +remove_vertex(v, g) +add_edge(u, v, g) +remove_edge(u, v, g) +remove_edge(e, g) + + + @@ -313,11 +322,11 @@ number of edges in the graph. Graph +add_vertex(vp, g) +add_edge(u, v, ep, g) diff --git a/docs/kevin_bacon.html b/docs/kevin_bacon.html index f81fcc37..14779f3d 100644 --- a/docs/kevin_bacon.html +++ b/docs/kevin_bacon.html @@ -200,7 +200,7 @@ will not be inserted into the graph.

   Edge e;
-  boost::tie(e, inserted) = add_edge(g, u, v);
+  boost::tie(e, inserted) = add_edge(u, v, g);
   if (inserted) {
     connecting_movie[e] = movie_name;
     weight[e] = 1;
diff --git a/docs/quick_tour.html b/docs/quick_tour.html
index 8259187e..e3c17279 100644
--- a/docs/quick_tour.html
+++ b/docs/quick_tour.html
@@ -116,7 +116,7 @@ convenient way to explicitly create the edges for this example.
 
     // add the edges to the graph object
     for (int i = 0; i < num_edges; ++i)
-      add_edge(g, edge_array[i].first, edge_array[i].second);
+      add_edge(edge_array[i].first, edge_array[i].second, g);
     ...
     return 0;
   }
diff --git a/docs/transpose_graph.html b/docs/transpose_graph.html
index f54b0b96..7e12978a 100644
--- a/docs/transpose_graph.html
+++ b/docs/transpose_graph.html
@@ -59,7 +59,7 @@ no edges. The edges will be added by transpose_graph() by
 calling add_edge as follows for each edge (u,v) in
 G:
 
-add_edge(G_T, vertex(get(index, v), G_T), vertex(get(index, u), G_T));
+add_edge(vertex(get(index, v), G_T), vertex(get(index, u), G_T), G_T);
 
diff --git a/docs/using_adjacency_list.html b/docs/using_adjacency_list.html index 78e4d67d..6e16a5cd 100644 --- a/docs/using_adjacency_list.html +++ b/docs/using_adjacency_list.html @@ -498,7 +498,7 @@ owes who''. MyGraphType G(5); for (int i = 0; i < 11; ++i) - add_edge(G, edge_array[i].first, edge_array[i].second); + add_edge(edge_array[i].first, edge_array[i].second, G); property_map<MyGraphType, first_vertex_name_t>::type name = get(first_vertex_name, G); diff --git a/docs/using_boost_graph_library.html b/docs/using_boost_graph_library.html index 7e0fe4d0..e350197f 100644 --- a/docs/using_boost_graph_library.html +++ b/docs/using_boost_graph_library.html @@ -485,7 +485,7 @@ owes who''. MyGraphType G(5); for (int i = 0; i < 11; ++i) - add_edge(G, edge_array[i].first, edge_array[i].second); + add_edge(edge_array[i].first, edge_array[i].second, G); property_map<MyGraphType, first_vertex_name_t>::type name = get(first_vertex_name, G); diff --git a/docs/using_property_maps.html b/docs/using_property_maps.html index c1e551b7..12dd0d8e 100644 --- a/docs/using_property_maps.html +++ b/docs/using_property_maps.html @@ -254,7 +254,7 @@ the flow and capacity values.

   typedef adjacency_list<vecS, vecS, bidirectionalS, 
-    no_property, property<vertex_index_t, std::size_t> > Graph;
+    no_property, property<edge_index_t, std::size_t> > Graph;
 
   const int num_vertices = 9;
   Graph G(num_vertices);
@@ -263,11 +263,11 @@ the flow and capacity values.
   int flow_array[] = { 8, 12, 12, 12, 12, 12, 16, 16, 16, 8 };
 
   // Add edges to the graph, and assign each edge an ID number.
-  add_edge(G, 0, 1, 0);
+  add_edge(0, 1, 0, G);
   // ...
 
   typedef boost::graph_traits<Graph>::edge_descriptor Edge;
-  typedef property_map<Graph,vertex_index_t>::type EdgeID_Map;
+  typedef property_map<Graph, edge_index_t>::type EdgeID_Map;
   EdgeID_Map edge_id = get(edge_index, G);
 
   boost::random_access_iterator_property_map
diff --git a/examples/adjacency_list.cpp b/examples/adjacency_list.cpp
index 6d58ea13..0cffec21 100644
--- a/examples/adjacency_list.cpp
+++ b/examples/adjacency_list.cpp
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
   using namespace std;
 
   typedef property EdgeProperty;
-  typedef property ColorProperty;
+  typedef property ColorProperty;
   typedef property VertexProperty;
 
   typedef adjacency_list::vertex_iterator i, end;
+  graph_traits::out_edge_iterator ei, edge_end;
   for (boost::tie(i,end) = vertices(g); i != end; ++i) {
     cout << id[*i] << " ";
     for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
@@ -93,7 +93,12 @@ int main(int argc, char* argv[])
   print_edges(g, id);
 
   cout << endl << "removing edge (1,3): " << endl;  
-  remove_edge(g, vertex(1,g), vertex(3,g));
+  remove_edge(vertex(1,g), vertex(3,g), g);
+
+  ei = out_edges(vertex(1, g), g).first;
+  cout << "removing edge (" << id[source(*ei,g)] 
+       << "," << id[target(*ei,g)] << ")" << endl;
+  remove_edge(ei, g);
 
   for(boost::tie(i,end) = vertices(g); i != end; ++i) {
     cout << id[*i] << " ";
diff --git a/examples/adjacency_list.expected b/examples/adjacency_list.expected
index 51f683ce..f85d7549 100644
--- a/examples/adjacency_list.expected
+++ b/examples/adjacency_list.expected
@@ -6,9 +6,10 @@
 (0,1) (1,2) (1,3) (2,4) (3,4) 
 
 removing edge (1,3): 
-0  --joe--> 1  
-1  --joe--> 0   --curly--> 2  
+removing edge (1,0)
+0 
+1  --curly--> 2  
 2  --curly--> 1   --tom--> 4  
 3  --harry--> 4  
 4  --tom--> 2   --harry--> 3  
-(0,1) (1,2) (2,4) (3,4) 
+(1,2) (2,4) (3,4) 
diff --git a/examples/bfs.cpp b/examples/bfs.cpp
index f0afdcbe..4b400683 100644
--- a/examples/bfs.cpp
+++ b/examples/bfs.cpp
@@ -92,7 +92,7 @@ struct graph_copier
 
   template 
   void operator()(Edge e, Graph& g) {
-    boost::add_edge(new_g, boost::source(e, g), boost::target(e, g));
+    boost::add_edge(boost::source(e, g), boost::target(e, g), new_g);
   }
 private:
   NewGraph& new_g;
@@ -115,17 +115,17 @@ int main(int argc, char* argv[])
   > Graph;
   
   Graph G(5);
-  boost::add_edge(G, 0, 2);
-  boost::add_edge(G, 1, 1);
-  boost::add_edge(G, 1, 3);
-  boost::add_edge(G, 1, 4);
-  boost::add_edge(G, 2, 1);
-  boost::add_edge(G, 2, 3);
-  boost::add_edge(G, 2, 4);
-  boost::add_edge(G, 3, 1);
-  boost::add_edge(G, 3, 4);
-  boost::add_edge(G, 4, 0);
-  boost::add_edge(G, 4, 1);
+  boost::add_edge(0, 2, G);
+  boost::add_edge(1, 1, G);
+  boost::add_edge(1, 3, G);
+  boost::add_edge(1, 4, G);
+  boost::add_edge(2, 1, G);
+  boost::add_edge(2, 3, G);
+  boost::add_edge(2, 4, G);
+  boost::add_edge(3, 1, G);
+  boost::add_edge(3, 4, G);
+  boost::add_edge(4, 0, G);
+  boost::add_edge(4, 1, G);
 
   typedef Graph::vertex_descriptor Vertex;
 
diff --git a/examples/concept_checks.cpp b/examples/concept_checks.cpp
index b66919ba..9b7c3d96 100644
--- a/examples/concept_checks.cpp
+++ b/examples/concept_checks.cpp
@@ -86,6 +86,18 @@ main(int,char*[])
     REQUIRE3(Graph, Vertex, vertex_color_t, PropertyGraph);
     REQUIRE3(Graph, Edge, edge_weight_t, PropertyGraph);
   }
+  {
+    typedef adjacency_list< listS, listS, undirectedS, 
+      property,
+      property
+    > Graph;
+    typedef graph_traits::vertex_descriptor Vertex;
+    typedef graph_traits::edge_descriptor Edge;
+    REQUIRE(Graph, VertexAndEdgeListGraph);
+    REQUIRE(Graph, MutableGraph);
+    REQUIRE3(Graph, Vertex, vertex_color_t, PropertyGraph);
+    REQUIRE3(Graph, Edge, edge_weight_t, PropertyGraph);
+  }
   {
     typedef std::pair E;
     typedef edge_list EdgeList;
diff --git a/examples/connected_components.cpp b/examples/connected_components.cpp
index d0ad11da..83c1e34f 100644
--- a/examples/connected_components.cpp
+++ b/examples/connected_components.cpp
@@ -77,10 +77,10 @@ int main(int argc, char* argv[])
 
     const int N = 6;
     Graph G(N);
-    add_edge(G, 0, 1);
-    add_edge(G, 1, 4);
-    add_edge(G, 4, 0);
-    add_edge(G, 2, 5);
+    add_edge(0, 1, G);
+    add_edge(1, 4, G);
+    add_edge(4, 0, G);
+    add_edge(2, 5, G);
     
     
     std::vector c(num_vertices(G));
@@ -104,14 +104,14 @@ int main(int argc, char* argv[])
     typedef adjacency_list< vecS, vecS, directedS, VertexProperty >  Graph;
     const int N = 6;
     Graph G(N);
-    add_edge(G, 0, 1);
-    add_edge(G, 1, 1);
-    add_edge(G, 1, 3);
-    add_edge(G, 1, 4);
-    add_edge(G, 4, 3);
-    add_edge(G, 3, 4);
-    add_edge(G, 3, 0);
-    add_edge(G, 5, 2);
+    add_edge(0, 1, G);
+    add_edge(1, 1, G);
+    add_edge(1, 3, G);
+    add_edge(1, 4, G);
+    add_edge(4, 3, G);
+    add_edge(3, 4, G);
+    add_edge(3, 0, G);
+    add_edge(5, 2, G);
 
     typedef Graph::vertex_descriptor Vertex;
     
diff --git a/examples/cuthill_mckee_ordering.cpp b/examples/cuthill_mckee_ordering.cpp
index 61cb6324..3ca01f3f 100644
--- a/examples/cuthill_mckee_ordering.cpp
+++ b/examples/cuthill_mckee_ordering.cpp
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
   
   Graph G(10);
   for (int i=0; i<14; ++i)
-    add_edge(G, edges[i].first, edges[i].second);
+    add_edge(edges[i].first, edges[i].second, G);
 
 
   Graph::vertex_iterator ui, uiend;
diff --git a/examples/dave.cpp b/examples/dave.cpp
index 7fffd614..9015a192 100644
--- a/examples/dave.cpp
+++ b/examples/dave.cpp
@@ -139,7 +139,7 @@ struct graph_copier
 
   template 
   void operator()(Edge e, Graph& g) {
-    add_edge(new_g, source(e, g), target(e, g));
+    add_edge(source(e, g), target(e, g), new_g);
   }
 private:
   NewGraph& new_g;
@@ -197,7 +197,7 @@ main(int argc, char* argv[])
                    1, 2 };
 
   for (int i = 0; i < 12; ++i)
-    add_edge(G, edges[i].first, edges[i].second, weight[i]);
+    add_edge(edges[i].first, edges[i].second, weight[i], G);
 
   print(G, name);
 
diff --git a/examples/dfs.cpp b/examples/dfs.cpp
index 876cba24..316ba6fc 100644
--- a/examples/dfs.cpp
+++ b/examples/dfs.cpp
@@ -100,15 +100,15 @@ main(int argc, char* argv[])
   typedef adjacency_list<> Graph;
   
   Graph G(5);
-  add_edge(G, 0, 2);
-  add_edge(G, 1, 1);
-  add_edge(G, 1, 3);
-  add_edge(G, 2, 1);
-  add_edge(G, 2, 3);
-  add_edge(G, 3, 1);
-  add_edge(G, 3, 4);
-  add_edge(G, 4, 0);
-  add_edge(G, 4, 1);
+  add_edge(0, 2, G);
+  add_edge(1, 1, G);
+  add_edge(1, 3, G);
+  add_edge(2, 1, G);
+  add_edge(2, 3, G);
+  add_edge(3, 1, G);
+  add_edge(3, 4, G);
+  add_edge(4, 0, G);
+  add_edge(4, 1, G);
 
   typedef graph_traits::vertex_descriptor Vertex;
   typedef graph_traits::vertices_size_type size_type;
diff --git a/examples/dijkstra.cpp b/examples/dijkstra.cpp
index 66bf5957..e30377eb 100644
--- a/examples/dijkstra.cpp
+++ b/examples/dijkstra.cpp
@@ -89,7 +89,7 @@ main(int argc, char* argv[])
   adjacency_list<> tree(num_nodes);
   tie(vi,vend) = vertices(G);
   for(++vi; vi != vend; ++vi)
-    add_edge(tree, p[*vi], *vi);
+    add_edge(p[*vi], *vi, tree);
 
   print_graph(tree);
 
diff --git a/examples/dynamic_components.cpp b/examples/dynamic_components.cpp
index 2327867b..24385e99 100644
--- a/examples/dynamic_components.cpp
+++ b/examples/dynamic_components.cpp
@@ -84,16 +84,16 @@ int main(int argc, char* argv[])
 
   graph_traits::edge_descriptor e;
   bool flag;
-  boost::tie(e,flag) = add_edge(G, 0, 1);
+  boost::tie(e,flag) = add_edge(0, 1, G);
   ds.union_set(0,1);
 
-  boost::tie(e,flag) = add_edge(G, 1, 4);
+  boost::tie(e,flag) = add_edge(1, 4, G);
   ds.union_set(1,4);
 
-  boost::tie(e,flag) = add_edge(G, 4, 0);
+  boost::tie(e,flag) = add_edge(4, 0, G);
   ds.union_set(4,0);
 
-  boost::tie(e,flag) = add_edge(G, 2, 5);
+  boost::tie(e,flag) = add_edge(2, 5, G);
   ds.union_set(2,5);
     
   cout << "An undirected graph:" << endl;
diff --git a/examples/edge_basics.cpp b/examples/edge_basics.cpp
index 40285c46..481bfb38 100644
--- a/examples/edge_basics.cpp
+++ b/examples/edge_basics.cpp
@@ -93,7 +93,7 @@ main()
   // specifying the number of vertices as 5
   MyGraph G(5);
   for (int i=0; i<8; ++i)
-    add_edge(G, edge_array[i].first, edge_array[i].second);
+    add_edge(edge_array[i].first, edge_array[i].second, G);
 
   // Use the STL for_each algorithm to "exercise" all of the edges in
   // the graph
diff --git a/examples/edge_property.cpp b/examples/edge_property.cpp
index 8f001fe5..9098b8ff 100644
--- a/examples/edge_property.cpp
+++ b/examples/edge_property.cpp
@@ -96,20 +96,20 @@ int main(int argc, char* argv[])
              4----->7
    */
 
-  add_edge(G, 0, 1, Flow(10, Cap(8)));
+  add_edge(0, 1, Flow(10, Cap(8)), G);
 
-  add_edge(G, 1, 4, Flow(20, Cap(12)));
-  add_edge(G, 4, 7, Flow(20, Cap(12)));
-  add_edge(G, 7, 6, Flow(20, Cap(12)));
+  add_edge(1, 4, Flow(20, Cap(12)), G);
+  add_edge(4, 7, Flow(20, Cap(12)), G);
+  add_edge(7, 6, Flow(20, Cap(12)), G);
 
-  add_edge(G, 1, 3, Flow(40, Cap(12)));
-  add_edge(G, 3, 6, Flow(40, Cap(12)));
+  add_edge(1, 3, Flow(40, Cap(12)), G);
+  add_edge(3, 6, Flow(40, Cap(12)), G);
 
-  add_edge(G, 6, 5, Flow(20, Cap(16)));
-  add_edge(G, 5, 2, Flow(20, Cap(16)));
-  add_edge(G, 2, 1, Flow(20, Cap(16)));
+  add_edge(6, 5, Flow(20, Cap(16)), G);
+  add_edge(5, 2, Flow(20, Cap(16)), G);
+  add_edge(2, 1, Flow(20, Cap(16)), G);
 
-  add_edge(G, 6, 8, Flow(10, Cap(8)));
+  add_edge(6, 8, Flow(10, Cap(8)), G);
 
   typedef boost::graph_traits::edge_descriptor Edge;
 
@@ -128,7 +128,7 @@ int main(int argc, char* argv[])
       flow[*e] = ++f;
   cout << endl << endl;
 
-  remove_edge(G, 6, 8);
+  remove_edge(6, 8, G);
 
   print_network(G, capacity, flow);
 
diff --git a/examples/exterior_edge_properties.cpp b/examples/exterior_edge_properties.cpp
index 16fa0963..c90750c1 100644
--- a/examples/exterior_edge_properties.cpp
+++ b/examples/exterior_edge_properties.cpp
@@ -104,20 +104,20 @@ int main(int argc, char* argv[]) {
 
   // insert edges into the graph, and assign each edge an ID number
   // to index into the property arrays
-  boost::add_edge(G, 0, 1, 0);
+  boost::add_edge(0, 1, 0, G);
 
-  boost::add_edge(G, 1, 4, 1);
-  boost::add_edge(G, 4, 7, 2);
-  boost::add_edge(G, 7, 6, 3);
+  boost::add_edge(1, 4, 1, G);
+  boost::add_edge(4, 7, 2, G);
+  boost::add_edge(7, 6, 3, G);
 
-  boost::add_edge(G, 1, 3, 4);
-  boost::add_edge(G, 3, 6, 5);
+  boost::add_edge(1, 3, 4, G);
+  boost::add_edge(3, 6, 5, G);
 
-  boost::add_edge(G, 6, 5, 6);
-  boost::add_edge(G, 5, 2, 7);
-  boost::add_edge(G, 2, 1, 8);
+  boost::add_edge(6, 5, 6, G);
+  boost::add_edge(5, 2, 7, G);
+  boost::add_edge(2, 1, 8, G);
 
-  boost::add_edge(G, 6, 8, 9);
+  boost::add_edge(6, 8, 9, G);
 
   typedef boost::property_map::type EdgeIndexMap;
   EdgeIndexMap edge_id = boost::get(boost::edge_index, G);
diff --git a/examples/exterior_property_map.cpp b/examples/exterior_property_map.cpp
index d49a7e8e..e3a2fa2e 100644
--- a/examples/exterior_property_map.cpp
+++ b/examples/exterior_property_map.cpp
@@ -101,7 +101,7 @@ main(int, char*[])
 
     MyGraphType G(5);
     for (int i=0; i<11; ++i)
-      add_edge(G, edge_array[i].first, edge_array[i].second);
+      add_edge(edge_array[i].first, edge_array[i].second, G);
 
   who_owes_who(edges(G).first, edges(G).second, G, names);
 
diff --git a/examples/family_tree.cpp b/examples/family_tree.cpp
index 9db4db49..ebdbf136 100644
--- a/examples/family_tree.cpp
+++ b/examples/family_tree.cpp
@@ -70,12 +70,12 @@ int main(int argc, char* argv[])
   name[Benjamin] = "Benjamin";
 
   adjacency_list<>  G(N);
-  add_edge(G, Jeanie, Debbie);
-  add_edge(G, Jeanie, Rick);
-  add_edge(G, Jeanie, John);
-  add_edge(G, Debbie, Amanda);
-  add_edge(G, Rick, Margaret);
-  add_edge(G, John, Benjamin);
+  add_edge(Jeanie, Debbie, G);
+  add_edge(Jeanie, Rick, G);
+  add_edge(Jeanie, John, G);
+  add_edge(Debbie, Amanda, G);
+  add_edge(Rick, Margaret, G);
+  add_edge(John, Benjamin, G);
 
   graph_traits >::vertex_iterator i, end;
   graph_traits >::adjacency_iterator ai, a_end;
diff --git a/examples/file_dependencies.cpp b/examples/file_dependencies.cpp
index 157d3c3d..59076c56 100644
--- a/examples/file_dependencies.cpp
+++ b/examples/file_dependencies.cpp
@@ -192,7 +192,7 @@ int main(int,char*[])
   // add a dependency going from bar.cpp to dax.h
   {
     cout << "adding edge bar_cpp -> dax_h" << endl;
-    add_edge(g, bar_cpp, dax_h);
+    add_edge(bar_cpp, dax_h, g);
   }
   cout << endl;
 
diff --git a/examples/graph.cpp b/examples/graph.cpp
index f1b44535..51bc463e 100644
--- a/examples/graph.cpp
+++ b/examples/graph.cpp
@@ -86,7 +86,7 @@ int main(int argc, char* argv[])
     while ( a == b ) b = myrand(N);
     cout << "edge edge (" << a << "," << b <<")" << endl;
     //add edges
-    add_edge(g, a, b);
+    add_edge(a, b, g);
     is_failed =  is_failed || (! check_edge(g, a, b) );
   }
   
@@ -102,7 +102,7 @@ int main(int argc, char* argv[])
     size_t a = myrand(N), b = myrand(N);
     while ( a == b ) b = myrand(N);
     cout << "remove edge (" << a << "," << b <<")" << endl;
-    remove_edge(g, a, b);
+    remove_edge(a, b, g);
     is_failed = is_failed || check_edge(g, a, b);
   }
   if ( is_failed )
@@ -131,8 +131,8 @@ int main(int argc, char* argv[])
     while ( b == vidp1 ) b = myrand(N);
     cout << "add edge (" << vid << "," << a <<")" << endl;
     cout << "add edge (" << vid << "," << vidp1 <<")" << endl;
-    add_edge(g, vid, a);
-    add_edge(g, b, vidp1);
+    add_edge(vid, a, g);
+    add_edge(b, vidp1, g);
     is_failed = is_failed || ! check_edge(g, vid, a);
     is_failed = is_failed || ! check_edge(g, b, vidp1);
   }
@@ -145,13 +145,13 @@ int main(int argc, char* argv[])
   // clear_vertex
   size_t c = myrand(N);
   is_failed = false;
-  clear_vertex(g, c);
+  clear_vertex(c, g);
 
   if ( out_degree(c, g) != 0 )
     is_failed = true;
 
   cout << "Removing vertex " << c << endl;
-  remove_vertex(g, c);
+  remove_vertex(c, g);
   
   old_N = N;
   N = num_vertices(g);
diff --git a/examples/in_edges.cpp b/examples/in_edges.cpp
index 014afd1a..d6192509 100644
--- a/examples/in_edges.cpp
+++ b/examples/in_edges.cpp
@@ -49,11 +49,11 @@ int main(int argc, char* argv[])
   const int num_vertices = 5;
   Graph g(num_vertices);
 
-  add_edge(g, 0, 1);
-  add_edge(g, 1, 2);
-  add_edge(g, 1, 3);
-  add_edge(g, 2, 4);
-  add_edge(g, 3, 4);
+  add_edge(0, 1, g);
+  add_edge(1, 2, g);
+  add_edge(1, 3, g);
+  add_edge(2, 4, g);
+  add_edge(3, 4, g);
 
   boost::graph_traits::vertex_iterator i, end;
   boost::graph_traits::in_edge_iterator ei, edge_end;
diff --git a/examples/interior_property_map.cpp b/examples/interior_property_map.cpp
index 4b60e72c..51a6b17e 100644
--- a/examples/interior_property_map.cpp
+++ b/examples/interior_property_map.cpp
@@ -104,7 +104,7 @@ main()
     
     MyGraphType G(5);
     for (int i=0; i<11; ++i)
-      add_edge(G, edge_array[i].first, edge_array[i].second);
+      add_edge(edge_array[i].first, edge_array[i].second, G);
 
     property_map::type name
       = get(vertex_first_name, G);
diff --git a/examples/kevin_bacon.cpp b/examples/kevin_bacon.cpp
index 3b0d70d0..1c666e43 100644
--- a/examples/kevin_bacon.cpp
+++ b/examples/kevin_bacon.cpp
@@ -95,7 +95,7 @@ main()
       v = pos->second;
 
     Edge e;
-    tie(e, inserted) = add_edge(g, u, v);
+    tie(e, inserted) = add_edge(u, v, g);
     if (inserted) {
       put(connecting_movie, e, movie_name);
       put(weight, e, 1);
diff --git a/examples/quick_tour.cpp b/examples/quick_tour.cpp
index b96af78b..a8951dfa 100644
--- a/examples/quick_tour.cpp
+++ b/examples/quick_tour.cpp
@@ -100,7 +100,7 @@ int main(int,char*[])
 
   // add the edges to the graph object
   for (int i = 0; i < num_edges; ++i)
-    add_edge(g, edge_array[i].first, edge_array[i].second);
+    add_edge(edge_array[i].first, edge_array[i].second, g);
   
   std::cout << "vertices(g) = ";
   typedef graph_traits::vertex_iterator vertex_iter;
diff --git a/examples/undirected.cpp b/examples/undirected.cpp
index 1bf73bb0..5461e05f 100644
--- a/examples/undirected.cpp
+++ b/examples/undirected.cpp
@@ -66,8 +66,8 @@ main(int, char*[])
     graph_traits::vertex_descriptor u, v;
     u = vertex(0, digraph);
     v = vertex(1, digraph);
-    add_edge(digraph, u, v, Weight(1.2));
-    add_edge(digraph, v, u, Weight(2.4));
+    add_edge(u, v, Weight(1.2), digraph);
+    add_edge(v, u, Weight(2.4), digraph);
     graph_traits::edge_descriptor e1, e2;
     bool found;
     tie(e1,found) = edge(u, v, digraph);
@@ -84,7 +84,7 @@ main(int, char*[])
     graph_traits::vertex_descriptor u, v;
     u = vertex(0, undigraph);
     v = vertex(1, undigraph);
-    add_edge(undigraph, u, v, Weight(3.1));
+    add_edge(u, v, Weight(3.1), undigraph);
     graph_traits::edge_descriptor e1, e2;
     bool found;
     tie(e1,found) = edge(u, v, undigraph);
diff --git a/examples/vertex_basics.cpp b/examples/vertex_basics.cpp
index a81bfd77..10cffa04 100644
--- a/examples/vertex_basics.cpp
+++ b/examples/vertex_basics.cpp
@@ -154,7 +154,7 @@ main()
   /* Construct a graph using the edge_array*/
   MyGraphType g(5);
   for (int i=0; i<11; ++i)
-    add_edge(g, edge_array[i].first, edge_array[i].second);
+    add_edge(edge_array[i].first, edge_array[i].second, g);
 
   boost::property_map::type 
     id = get(vertex_index, g);
diff --git a/include/boost/graph/detail/adjacency_list.hpp b/include/boost/graph/detail/adjacency_list.hpp
index 0b385d89..e93354b4 100644
--- a/include/boost/graph/detail/adjacency_list.hpp
+++ b/include/boost/graph/detail/adjacency_list.hpp
@@ -143,6 +143,10 @@ namespace boost {
       inline bool operator==(const self& x) const { return i == x.i; }
 
       inline self* operator->() { return this; }
+
+      OutEdgeIter& iter() { return i; }
+      const OutEdgeIter& iter() const { return i; }
+
       /*    protected: */
       OutEdgeIter i;
       Graph* g;
@@ -246,6 +250,7 @@ namespace boost {
         boost::less_than_comparable1< stored_edge > >
     {
     public:
+      typedef no_property property_type;
       inline stored_edge(Vertex target, const no_property& = no_property())
         : m_target(target) { }
       inline Vertex& get_target() { return m_target; }
@@ -262,6 +267,7 @@ namespace boost {
     template 
     class stored_edge_property : public stored_edge {
     public:
+      typedef Property property_type;
       inline stored_edge_property(Vertex target, const Property& p = Property())
         : stored_edge(target), m_property(p) { }
       inline Property* get_property() { return &m_property; }
@@ -271,15 +277,17 @@ namespace boost {
     };
 
     template 
-    class se_iter // having symbol length problems with VC++
-      : public stored_edge // there is some redundant storage
-      // of the target vertex, but it is difficult to remove...
+    class stored_edge_with_iter
+      : public stored_edge
     {
     public:
-      inline se_iter(Vertex v, Iter i = Iter())
+      typedef Property property_type;
+      inline stored_edge_with_iter(Vertex v, Iter i = Iter())
         : stored_edge(v), m_iter(i) { }
       inline Property* get_property() { return m_iter->get_property(); }
-      inline const Property* get_property() const { return m_iter->get_property(); }
+      inline const Property* get_property() const { 
+        return m_iter->get_property();
+      }
       inline Iter get_iter() const { return m_iter; }
     protected:
       Iter m_iter;
@@ -310,50 +318,54 @@ namespace boost {
                                            g.vertex_set().end(),
                                            g.vertex_set().end(), g) );
     }
-    template 
-    inline void
-    remove_out_edge_if(directed_edges_helper& g_, 
-                       vertex_descriptor v, Predicate pred)
-    {
-      typedef typename Config::graph_type graph_type;
-      graph_type& g = static_cast(g_);
-      typedef typename Config::edge_parallel_category edge_parallel_category;
-      remove_edge_if_dispatch(g.out_edge_list(v), pred,
-                              edge_parallel_category());
-    }
-    template 
-    inline void
-    remove_in_edge_if(directed_edges_helper& g_, 
-                      vertex_descriptor v, Predicate pred)
-    {
-      typedef typename Config::graph_type graph_type;
-      graph_type& g = static_cast(g_);
-      typedef typename Config::edge_parallel_category edge_parallel_category;
-      remove_edge_if_dispatch(g.in_edge_list(v), pred,
-                              edge_parallel_category());
-    }
-    template 
-    inline void
-    remove_edge_if_dispatch(EdgeList& el, Predicate pred,
-                            boost::allow_parallel_edge_tag)
-    {
-      typename EdgeList::iterator
-        pos = std::remove_if(el.begin(), el.end(), pred);
-      el.erase(pos, el.end());
-    }
-    template 
-    inline void
-    remove_edge_if_dispatch(EdgeList& el, Predicate pred,
-                            boost::disallow_parallel_edge_tag)
-    {
-      typename EdgeList::iterator pos = el.begin(), next = el.begin(), 
-        end = el.end();
-      for (; pos != end; pos = next) {
-        ++next;
-        if (pred(*pos))
-          el.erase(pred);
+    namespace detail {
+      template 
+      inline void
+      remove_edge_if_dispatch(EdgeList& el, Predicate pred,
+                              boost::allow_parallel_edge_tag)
+      {
+        typename EdgeList::iterator
+          pos = std::remove_if(el.begin(), el.end(), pred);
+        el.erase(pos, el.end());
       }
+      template 
+      inline void
+      remove_edge_if_dispatch(EdgeList& el, Predicate pred,
+                              boost::disallow_parallel_edge_tag)
+      {
+        typename EdgeList::iterator pos = el.begin(), next = el.begin(), 
+          end = el.end();
+        for (; pos != end; pos = next) {
+          ++next;
+          if (pred(*pos))
+            el.erase(pred);
+        }
+      }
+    } // namespace detail
+
+    template 
+    inline void
+    remove_out_edge_if(vertex_descriptor v, Predicate pred,
+                       directed_edges_helper& g_)
+    {
+      typedef typename Config::graph_type graph_type;
+      graph_type& g = static_cast(g_);
+      typedef typename Config::edge_parallel_category edge_parallel_category;
+      detail::remove_edge_if_dispatch(g.out_edge_list(v), pred,
+                                      edge_parallel_category());
     }
+    template 
+    inline void
+    remove_in_edge_if(vertex_descriptor v, Predicate pred,
+                      directed_edges_helper& g_)
+    {
+      typedef typename Config::graph_type graph_type;
+      graph_type& g = static_cast(g_);
+      typedef typename Config::edge_parallel_category edge_parallel_category;
+      detail::remove_edge_if_dispatch(g.in_edge_list(v), pred,
+                                      edge_parallel_category());
+    }
+
     // need to make sure remove_edge_if works for undirected & bidirectional
     // and add tests for it in test/graph.cpp
 
@@ -363,9 +375,9 @@ namespace boost {
     // O(E/V) or O(log(E/V)) depending on OutEdgeList type
     template 
     inline void
-    remove_edge(directed_graph_helper& g_, 
-                typename Config::vertex_descriptor u, 
-                typename Config::vertex_descriptor v)
+    remove_edge(typename Config::vertex_descriptor u,
+                typename Config::vertex_descriptor v,
+                directed_graph_helper& g_)
     {
       typedef typename Config::graph_type graph_type;
       typedef typename Config::StoredEdge StoredEdge;
@@ -374,12 +386,71 @@ namespace boost {
       boost::erase(el, StoredEdge(v));
     }
 
+
+    namespace detail {
+
+      // O(E/V)
+      template 
+      inline void
+      remove_directed_edge_dispatch(edge_descriptor, EdgeList& el,
+                                    StoredProperty* p)
+      {
+        typename EdgeList::iterator i = el.begin();
+        for (; i != el.end(); ++i)
+          if ((*i).get_property() == p) {
+            el.erase(i);
+            return;
+          }
+      }
+
+      // O(E/V)
+      template 
+      inline void
+      remove_directed_edge_dispatch(edge_descriptor e, EdgeList& el,
+                                    no_property*)
+      {
+        typename EdgeList::iterator i = el.begin();
+        for (; i != el.end(); ++i)
+          if ((*i).get_target() == e.m_target) {
+            el.erase(i);
+            return;
+          }
+      }
+
+    } // namespace detail
+
+    // O(E/V)
+    template 
+    inline void
+    remove_edge(typename Config::edge_descriptor e,
+                directed_graph_helper& g_)
+    {
+      typedef typename Config::graph_type graph_type;
+      graph_type& g = static_cast(g_);
+      typename Config::OutEdgeList& el = g.out_edge_list(source(e, g));
+      typedef typename Config::OutEdgeList::value_type::property_type PType;
+      detail::remove_directed_edge_dispatch(e, el, (PType*)e.get_property());
+    }
+
+    // O(1)
+    template 
+    inline void
+    remove_edge(typename Config::out_edge_iterator iter,
+                directed_graph_helper& g_)
+    {
+      typedef typename Config::graph_type graph_type;
+      graph_type& g = static_cast(g_);
+      typename Config::edge_descriptor e = *iter;
+      typename Config::OutEdgeList& el = g.out_edge_list(source(e, g));
+      el.erase(iter.iter());
+    }
+
     // O(V + E) for allow_parallel_edges
     // O(V * log(E/V)) for disallow_parallel_edges
     template 
     inline void 
-    clear_vertex(directed_graph_helper& g_, 
-                 typename Config::vertex_descriptor u)
+    clear_vertex(typename Config::vertex_descriptor u,
+                 directed_graph_helper& g_)
     {
       typedef typename Config::graph_type graph_type;
       typedef typename Config::StoredEdge StoredEdge;
@@ -409,10 +480,10 @@ namespace boost {
     // O(log(E/V)) for disallow_parallel_edge_tag
     template 
     inline std::pair
-    add_edge(directed_graph_helper& g_, 
-             typename Config::vertex_descriptor u, 
+    add_edge(typename Config::vertex_descriptor u, 
              typename Config::vertex_descriptor v,
-             const typename Config::edge_property_type& p)
+             const typename Config::edge_property_type& p, 
+             directed_graph_helper& g_)
     {
       typedef typename Config::edge_descriptor edge_descriptor;
       typedef typename Config::graph_type graph_type;
@@ -429,12 +500,12 @@ namespace boost {
     // causes Visual C++ to get confused.
     template 
     inline std::pair
-    add_edge(directed_graph_helper& g_, 
-             typename Config::vertex_descriptor u, 
-             typename Config::vertex_descriptor v)
+    add_edge(typename Config::vertex_descriptor u, 
+             typename Config::vertex_descriptor v,
+             directed_graph_helper& g_)
     {
       typename Config::edge_property_type p;
-      return add_edge(g_, u, v, p);
+      return add_edge(u, v, p, g_);
     }
     //=========================================================================
     // Undirected Graph Helper Class
@@ -443,6 +514,7 @@ namespace boost {
     struct undir_edge // short name due to VC++ truncation and linker problems
       : public boost::detail::edge_base
     {
+      typedef EdgeProperty property_type;
       typedef boost::detail::edge_base Base;
       undir_edge(Vertex u, Vertex v, const EdgeProperty& p = EdgeProperty())
         : Base(u, v), m_property(p) { }
@@ -452,13 +524,16 @@ namespace boost {
     };
 
     template 
-    struct undir_edge_no_p  // short name due to VC++ truncation and linker problems
-      : public boost::detail::edge_base {
+    struct undir_edge_no_p
+      // short name due to VC++ truncation and linker problems
+      : public boost::detail::edge_base
+    {
+      typedef no_property property_type;
       typedef boost::detail::edge_base Base;
       template 
       undir_edge_no_p (Vertex u, Vertex v, const EdgeProperty& )
         : Base(u, v) { }
-      boost::no_property* get_property() { return 0; }
+      no_property* get_property() { return 0; }
       const boost::no_property* get_property() const { return 0; }
     };
 
@@ -481,9 +556,9 @@ namespace boost {
     // O(E/V) or O(log(E/V))
     template 
     void
-    remove_edge(undirected_graph_helper& g_, 
-                typename Config::vertex_descriptor u, 
-                typename Config::vertex_descriptor v)
+    remove_edge(typename Config::vertex_descriptor u, 
+                typename Config::vertex_descriptor v, 
+                undirected_graph_helper& g_)
     {
       typedef typename Config::graph_type graph_type;
       typedef typename Config::StoredEdge StoredEdge;
@@ -492,6 +567,79 @@ namespace boost {
       remove_edge_and_property(g, g.out_edge_list(u), v, Cat());
       boost::erase(g.out_edge_list(v), StoredEdge(u));
     }
+
+    namespace detail {
+      // O(E/V)
+      template 
+      inline void
+      remove_undirected_edge_dispatch(edge_descriptor e, 
+                                      undirected_graph_helper& g_, 
+                                      StoredProperty* p)
+      {
+        typedef typename Config::graph_type graph_type;
+        graph_type& g = static_cast(g_);
+
+        typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g));
+        typename Config::OutEdgeList::iterator out_i = out_el.begin();
+        for (; out_i != out_el.end(); ++out_i)
+          if ((*out_i).get_property() == p) {
+            g.m_edges.erase((*out_i).get_iter());
+            out_el.erase(out_i);
+            break;
+          }
+        typename Config::OutEdgeList& in_el = g.out_edge_list(target(e, g));
+        typename Config::OutEdgeList::iterator in_i = in_el.begin();
+        for (; in_i != in_el.end(); ++in_i)
+          if ((*in_i).get_property() == p) {
+            in_el.erase(in_i);
+            return;
+          }
+      }
+      // O(E/V)
+      template 
+      inline void
+      remove_undirected_edge_dispatch(edge_descriptor e,
+                                      undirected_graph_helper& g_,
+                                      no_property*)
+      {
+        typedef typename Config::graph_type graph_type;
+        graph_type& g = static_cast(g_);
+
+        typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g));
+        typename Config::OutEdgeList::iterator out_i = out_el.begin();
+        for (; out_i != out_el.end(); ++out_i)
+          if ((*out_i).get_target() == target(e, g)) {
+            g.m_edges.erase((*out_i).get_iter());
+            out_el.erase(out_i);
+            break;
+          }
+        typename Config::OutEdgeList& in_el = g.out_edge_list(target(e, g));
+        typename Config::OutEdgeList::iterator in_i = in_el.begin();
+        for (; in_i != in_el.end(); ++in_i)
+          if ((*in_i).get_target() == source(e, g)) {
+            in_el.erase(in_i);
+            return;
+          }
+      }
+    } // namespace detail
+
+    // O(E/V)
+    template 
+    inline void
+    remove_edge(typename Config::edge_descriptor e,
+                undirected_graph_helper& g)
+    {
+      typedef typename Config::OutEdgeList::value_type::property_type PType;
+      detail::remove_undirected_edge_dispatch(e, g, (PType*)e.get_property());
+    }
+    // O(E/V)
+    template 
+    inline void
+    remove_edge(typename Config::out_edge_iterator iter,
+                undirected_graph_helper& g_)
+    {
+      remove_edge(*iter, g_);
+    }
     // O(1)
     template 
     inline typename Config::edges_size_type
@@ -504,8 +652,8 @@ namespace boost {
     // O(E/V * E/V) or O(E/V * log(E/V))
     template 
     inline void 
-    clear_vertex(undirected_graph_helper& g_, 
-                 typename Config::vertex_descriptor u)
+    clear_vertex(typename Config::vertex_descriptor u,
+                 undirected_graph_helper& g_)
     {
       typedef typename Config::graph_type graph_type;
       typedef typename Config::StoredEdge StoredEdge;
@@ -523,10 +671,10 @@ namespace boost {
     // O(log(E/V)) for disallow_parallel_edge_tag
     template 
     inline std::pair
-    add_edge(undirected_graph_helper& g_, 
-             typename Config::vertex_descriptor u, 
+    add_edge(typename Config::vertex_descriptor u, 
              typename Config::vertex_descriptor v, 
-             const typename Config::edge_property_type& p)
+             const typename Config::edge_property_type& p,
+             undirected_graph_helper& g_)
     {
       typedef typename Config::StoredEdge StoredEdge;
       typedef typename Config::edge_descriptor edge_descriptor;
@@ -554,12 +702,12 @@ namespace boost {
     }
     template 
     inline std::pair
-    add_edge(undirected_graph_helper& g_, 
-             typename Config::vertex_descriptor u, 
-             typename Config::vertex_descriptor v)
+    add_edge(typename Config::vertex_descriptor u, 
+             typename Config::vertex_descriptor v, 
+             undirected_graph_helper& g_)
     {
       typename Config::edge_property_type p;
-      return add_edge(g_, u, v, p);
+      return add_edge(u, v, p, g_);
     }
     // O(1)
     template 
@@ -569,32 +717,34 @@ namespace boost {
     {
       return out_degree(u, g);
     }
-    // O(E/V)
-    template 
-    inline void
-    remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, 
-                           boost::allow_parallel_edge_tag)
-    {
-      typedef typename EdgeList::value_type StoredEdge;
-      typename EdgeList::iterator i = el.begin(), end = el.end();
-      for (; i != end; ++i)
-        if ((*i).get_target() == v)
-          g.m_edges.erase((*i).get_iter());
-      boost::erase(el, StoredEdge(v));
-    }
-    // O(log(E/V))
-    template 
-    inline void
-    remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, 
-                           boost::disallow_parallel_edge_tag)
-    {
-      typedef typename EdgeList::value_type StoredEdge;
-      typename EdgeList::iterator i = el.find(StoredEdge(v)), end = el.end();
-      if (i != end) {
-        g.m_edges.erase((*i).get_iter());
-        el.erase(i);
+    namespace detail {
+      // O(E/V)
+      template 
+      inline void
+      remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, 
+                             boost::allow_parallel_edge_tag)
+      {
+        typedef typename EdgeList::value_type StoredEdge;
+        typename EdgeList::iterator i = el.begin(), end = el.end();
+        for (; i != end; ++i)
+          if ((*i).get_target() == v)
+            g.m_edges.erase((*i).get_iter());
+        boost::erase(el, StoredEdge(v));
       }
-    }
+      // O(log(E/V))
+      template 
+      inline void
+      remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, 
+                             boost::disallow_parallel_edge_tag)
+      {
+        typedef typename EdgeList::value_type StoredEdge;
+        typename EdgeList::iterator i = el.find(StoredEdge(v)), end = el.end();
+        if (i != end) {
+          g.m_edges.erase((*i).get_iter());
+          el.erase(i);
+        }
+      }
+    } // namespace detail
 
     //=========================================================================
     // Bidirectional Graph Helper Class (with edge properties)
@@ -616,17 +766,54 @@ namespace boost {
     // O(log(E/V)) for disallow_parallel_edge_tag
     template 
     inline void
-    remove_edge(bidirectional_graph_helper_with_property& g_, 
-                typename Config::vertex_descriptor u, 
-                typename Config::vertex_descriptor v)
+    remove_edge(typename Config::vertex_descriptor u, 
+                typename Config::vertex_descriptor v, 
+                bidirectional_graph_helper_with_property& g_)
     {
       typedef typename Config::graph_type graph_type;
       typedef typename Config::StoredEdge StoredEdge;
       graph_type& g = static_cast(g_);
       typedef typename Config::edge_parallel_category Cat;
-      remove_edge_and_property(g, g.out_edge_list(u), v, Cat());
+      detail::remove_edge_and_property(g, g.out_edge_list(u), v, Cat());
       boost::erase(g.in_edge_list(v), StoredEdge(u));
     }
+    // O(E/V)
+    template 
+    inline void
+    remove_edge(typename Config::edge_descriptor e,
+                bidirectional_graph_helper_with_property& g_)
+    {
+      typedef typename Config::graph_type graph_type;
+      graph_type& g = static_cast(g_);
+
+      typedef typename Config::OutEdgeList::value_type::property_type PType;
+      PType* p = (PType*) e.get_property();
+
+      typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g));
+      typename Config::OutEdgeList::iterator out_i = out_el.begin();
+      for (; out_i != out_el.end(); ++out_i)
+        if ((*out_i).get_property() == p) {
+          g.m_edges.erase((*out_i).get_iter());
+          out_el.erase(out_i);
+          break;
+        }
+      typename Config::InEdgeList& in_el = g.in_edge_list(target(e, g));
+      typename Config::InEdgeList::iterator in_i = in_el.begin();
+      for (; in_i != in_el.end(); ++in_i)
+        if ((*in_i).get_property() == p) {
+          in_el.erase(in_i);
+          break;
+        }
+    }
+
+    template 
+    inline void
+    remove_edge(typename Config::out_edge_iterator iter,
+                bidirectional_graph_helper_with_property& g_)
+    {
+      remove_edge(*iter, g_);
+    }
+
     // O(1)
     template 
     inline typename Config::edges_size_type
@@ -640,8 +827,8 @@ namespace boost {
     // O(E/V * log(E/V)) for disallow_parallel_edge_tag
     template 
     inline void
-    clear_vertex(bidirectional_graph_helper_with_property& g_, 
-                 typename Config::vertex_descriptor u)
+    clear_vertex(typename Config::vertex_descriptor u,
+                 bidirectional_graph_helper_with_property& g_)
     {
       typedef typename Config::graph_type graph_type;
       typedef typename Config::StoredEdge StoredEdge;
@@ -667,10 +854,10 @@ namespace boost {
     // O(log(E/V)) for disallow_parallel_edge_tag
     template 
     inline std::pair
-    add_edge(bidirectional_graph_helper_with_property& g_,
-             typename Config::vertex_descriptor u,
+    add_edge(typename Config::vertex_descriptor u,
              typename Config::vertex_descriptor v, 
-             const typename Config::edge_property_type& p)
+             const typename Config::edge_property_type& p,
+             bidirectional_graph_helper_with_property& g_)
     {
       typedef typename Config::graph_type graph_type;
       graph_type& g = static_cast(g_);
@@ -694,12 +881,12 @@ namespace boost {
     }
     template 
     inline std::pair
-    add_edge(bidirectional_graph_helper_with_property& g_,
-             typename Config::vertex_descriptor u,
-             typename Config::vertex_descriptor v)
+    add_edge(typename Config::vertex_descriptor u,
+             typename Config::vertex_descriptor v,
+             bidirectional_graph_helper_with_property& g_)
     {
       typename Config::edge_property_type p;
-      return add_edge(g_, u, v, p);
+      return add_edge(u, v, p, g_);
     }
     // O(1)
     template 
@@ -723,9 +910,9 @@ namespace boost {
     // O(log(E/V)) for disallow_parallel_edge_tag
     template 
     inline std::pair
-    add_edge(bidirectional_graph_helper_without_property& g_, 
-             typename Config::vertex_descriptor u, 
-             typename Config::vertex_descriptor v)
+    add_edge(typename Config::vertex_descriptor u, 
+             typename Config::vertex_descriptor v,
+             bidirectional_graph_helper_without_property& g_)
     {
       typedef typename Config::graph_type graph_type;
       typedef typename Config::StoredEdge StoredEdge;
@@ -745,9 +932,9 @@ namespace boost {
     // O(log(E/V)) for disallow_parallel_edge_tag
     template 
     inline void
-    remove_edge(bidirectional_graph_helper_without_property& g_,
-                typename Config::vertex_descriptor u,
-                typename Config::vertex_descriptor v)
+    remove_edge(typename Config::vertex_descriptor u,
+                typename Config::vertex_descriptor v,
+                bidirectional_graph_helper_without_property& g_)
     {
       typedef typename Config::graph_type graph_type;
       typedef typename Config::StoredEdge StoredEdge;
@@ -755,6 +942,31 @@ namespace boost {
       boost::erase(g.out_edge_list(u), StoredEdge(v));
       boost::erase(g.in_edge_list(v), StoredEdge(u));
     }
+    // O(E/V)
+    template 
+    inline void
+    remove_edge(typename Config::edge_descriptor e,
+                bidirectional_graph_helper_without_property& g_)
+    {
+      typedef typename Config::graph_type graph_type;
+      graph_type& g = static_cast(g_);
+
+      typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g));
+      typename Config::OutEdgeList::iterator out_i = out_el.begin();
+      for (; out_i != out_el.end(); ++i)
+        if ((*out_i).get_target() == target(e, g)) {
+          g.m_edges.erase((*out_i).get_iter());
+          out_el.erase(*out_i);
+          break;
+        }
+      typename Config::InEdgeList& in_el = g.in_edge_list(target(e, g));
+      typename Config::InEdgeList::iterator in_i = in_el.begin();
+      for (; in_i != in_el.end(); ++i)
+        if ((*in_i).get_target() == source(e, g)) {
+          in_el.erase(*in_i);
+          break;
+        }
+    }
     // O(V), could do better...
     template 
     inline typename Config::edges_size_type
@@ -772,8 +984,8 @@ namespace boost {
     // O(E/V * log(E/V)) for disallow_parallel_edge_tag
     template 
     inline void 
-    clear_vertex(bidirectional_graph_helper_without_property& g_, 
-                 typename Config::vertex_descriptor u)
+    clear_vertex(typename Config::vertex_descriptor u,
+                 bidirectional_graph_helper_without_property& g_)
     {
       typedef typename Config::graph_type graph_type;
       typedef typename Config::StoredEdge StoredEdge;
@@ -1078,7 +1290,7 @@ namespace boost {
           v[i] = add_vertex(static_cast(*this));
 
         while (first != last) {
-          add_edge(*this, v[(*first).first], v[(*first).second]);
+          add_edge(v[(*first).first], v[(*first).second], *this);
           ++first;
         }
         delete [] v;
@@ -1093,7 +1305,7 @@ namespace boost {
           v[i] = add_vertex(static_cast(*this));
 
         while (first != last) {
-          add_edge(*this, v[(*first).first], v[(*first).second], *ep_iter);
+          add_edge(v[(*first).first], v[(*first).second], *ep_iter, *this);
           ++first;
           ++ep_iter;
         }
@@ -1139,8 +1351,8 @@ namespace boost {
     }
     // O(1)
     template 
-    inline void remove_vertex(adj_list_impl& g_,
-                              typename Config::vertex_descriptor u)
+    inline void remove_vertex(typename Config::vertex_descriptor u,
+                              adj_list_impl& g_)
     {
       typedef typename Config::stored_vertex stored_vertex;
       Derived& g = static_cast(g_);
@@ -1196,8 +1408,8 @@ namespace boost {
         : m_vertices(num_vertices)
       {
         while (first != last) {
-          add_edge(static_cast(*this), 
-                   (*first).first, (*first).second);
+          add_edge((*first).first, (*first).second, 
+                   static_cast(*this));
           ++first;
         }
       }
@@ -1208,8 +1420,8 @@ namespace boost {
         : m_vertices(num_vertices)
       {
         while (first != last) {
-          add_edge(static_cast(*this), 
-                   (*first).first, (*first).second, *ep_iter);
+          add_edge((*first).first, (*first).second, *ep_iter, 
+                   static_cast(*this));
           ++first;
           ++ep_iter;
         }
@@ -1244,97 +1456,100 @@ namespace boost {
     }
     // O(V + E)
     template 
-    inline void remove_vertex(vec_adj_list_impl& g_,
-                              typename Config::vertex_descriptor v) {
-      typedef typename Config::directed_category Cat;
-      Graph& g = static_cast(g_);
-      remove_vertex_dispatch(g, v, Cat());
-    }
-    // O(1)
-    template 
-    inline typename Config::vertex_descriptor 
-    vertex(typename Config::vertices_size_type n, 
-           const vec_adj_list_impl&)
-    {
-      return n;
-    }
-
-    template 
-    inline void 
-    remove_vertex_dispatch(Graph& g, vertex_descriptor u, 
-                           boost::directed_tag)
-    {
-      typedef typename Graph::edge_parallel_category edge_parallel_category;
-      g.m_vertices.erase(g.m_vertices.begin() + u);
-      vertex_descriptor V = num_vertices(g);
-      for (vertex_descriptor v = 0; v < V; ++v)
-        reindex_edge_list(g.out_edge_list(v), u, edge_parallel_category());
-    }
-    template 
-    inline void 
-    remove_vertex_dispatch(Graph& g, vertex_descriptor u, 
-                           boost::undirected_tag)
-    {
-      typedef typename Graph::edge_parallel_category edge_parallel_category;
-      g.m_vertices.erase(g.m_vertices.begin() + u);
-      vertex_descriptor V = num_vertices(g);
-      for (vertex_descriptor v = 0; v < V; ++v)
-        reindex_edge_list(g.out_edge_list(v), u, 
-                          edge_parallel_category());
-
-      typename Graph::EdgeContainer::iterator 
-        ei = g.m_edges.begin(),
-        ei_end = g.m_edges.end();
-      for (; ei != ei_end; ++ei) {
-        if (ei->m_source > u)
-          --ei->m_source;
-        if (ei->m_target > u)
-          --ei->m_target;
+    inline void remove_vertex(typename Config::vertex_descriptor v,
+                                vec_adj_list_impl& g_) {
+        typedef typename Config::directed_category Cat;
+        Graph& g = static_cast(g_);
+        detail::remove_vertex_dispatch(g, v, Cat());
+      }
+      // O(1)
+      template 
+      inline typename Config::vertex_descriptor 
+      vertex(typename Config::vertices_size_type n, 
+             const vec_adj_list_impl&)
+      {
+        return n;
       }
-    }
-    template 
-    inline void 
-    remove_vertex_dispatch(Graph& g, vertex_descriptor u, 
-                           boost::bidirectional_tag)
-    {
-      typedef typename Graph::edge_parallel_category edge_parallel_category;
-      g.m_vertices.erase(g.m_vertices.begin() + u);
-      vertex_descriptor V = num_vertices(g);
-      vertex_descriptor v;
-      for (v = 0; v < V; ++v)
-        reindex_edge_list(g.out_edge_list(v), u, 
-                          edge_parallel_category());
-      for (v = 0; v < V; ++v)
-        reindex_edge_list(g.in_edge_list(v), u, 
-                          edge_parallel_category());
-    }
 
-    template 
-    inline void
-    reindex_edge_list(EdgeList& el, vertex_descriptor u, 
-                      boost::allow_parallel_edge_tag)
-    {
-      typename EdgeList::iterator ei = el.begin(), e_end = el.end();
-      for (; ei != e_end; ++ei)
-        if ((*ei).get_target() > u)
-          --(*ei).get_target();
-    }
-    template 
-    inline void
-    reindex_edge_list(EdgeList& el, vertex_descriptor u, 
-                      boost::disallow_parallel_edge_tag)
-    {
-      typename EdgeList::iterator ei = el.begin(), e_end = el.end();
-      while (ei != e_end) {
-        typename EdgeList::value_type ce = *ei;
-        ++ei;
-        if (ce.get_target() > u) {
-          el.erase(ce);
-          --ce.get_target();
-          el.insert(ce);
+    namespace detail {
+
+      template 
+      inline void 
+      remove_vertex_dispatch(Graph& g, vertex_descriptor u, 
+                             boost::directed_tag)
+      {
+        typedef typename Graph::edge_parallel_category edge_parallel_category;
+        g.m_vertices.erase(g.m_vertices.begin() + u);
+        vertex_descriptor V = num_vertices(g);
+        for (vertex_descriptor v = 0; v < V; ++v)
+          reindex_edge_list(g.out_edge_list(v), u, edge_parallel_category());
+      }
+      template 
+      inline void 
+      remove_vertex_dispatch(Graph& g, vertex_descriptor u, 
+                             boost::undirected_tag)
+      {
+        typedef typename Graph::edge_parallel_category edge_parallel_category;
+        g.m_vertices.erase(g.m_vertices.begin() + u);
+        vertex_descriptor V = num_vertices(g);
+        for (vertex_descriptor v = 0; v < V; ++v)
+          reindex_edge_list(g.out_edge_list(v), u, 
+                            edge_parallel_category());
+
+        typename Graph::EdgeContainer::iterator 
+          ei = g.m_edges.begin(),
+          ei_end = g.m_edges.end();
+        for (; ei != ei_end; ++ei) {
+          if (ei->m_source > u)
+            --ei->m_source;
+          if (ei->m_target > u)
+            --ei->m_target;
         }
       }
-    }
+      template 
+      inline void 
+      remove_vertex_dispatch(Graph& g, vertex_descriptor u, 
+                             boost::bidirectional_tag)
+      {
+        typedef typename Graph::edge_parallel_category edge_parallel_category;
+        g.m_vertices.erase(g.m_vertices.begin() + u);
+        vertex_descriptor V = num_vertices(g);
+        vertex_descriptor v;
+        for (v = 0; v < V; ++v)
+          reindex_edge_list(g.out_edge_list(v), u, 
+                            edge_parallel_category());
+        for (v = 0; v < V; ++v)
+          reindex_edge_list(g.in_edge_list(v), u, 
+                            edge_parallel_category());
+      }
+
+      template 
+      inline void
+      reindex_edge_list(EdgeList& el, vertex_descriptor u, 
+                        boost::allow_parallel_edge_tag)
+      {
+        typename EdgeList::iterator ei = el.begin(), e_end = el.end();
+        for (; ei != e_end; ++ei)
+          if ((*ei).get_target() > u)
+            --(*ei).get_target();
+      }
+      template 
+      inline void
+      reindex_edge_list(EdgeList& el, vertex_descriptor u, 
+                        boost::disallow_parallel_edge_tag)
+      {
+        typename EdgeList::iterator ei = el.begin(), e_end = el.end();
+        while (ei != e_end) {
+          typename EdgeList::value_type ce = *ei;
+          ++ei;
+          if (ce.get_target() > u) {
+            el.erase(ce);
+            --ce.get_target();
+            el.insert(ce);
+          }
+        }
+      }
+    } // namespace detail
 
   namespace detail {
 
@@ -1426,7 +1641,7 @@ namespace boost {
             stored_edge_property,  
             stored_edge
           >::type,
-          se_iter
+          stored_edge_with_iter
         >::type StoredEdge;
 
         // Adjacency Types
diff --git a/include/boost/graph/graph_concepts.hpp b/include/boost/graph/graph_concepts.hpp
index 175eaa7a..63c266f5 100644
--- a/include/boost/graph/graph_concepts.hpp
+++ b/include/boost/graph/graph_concepts.hpp
@@ -207,16 +207,18 @@ namespace boost {
     typedef typename graph_traits::edge_descriptor edge_descriptor;
     void constraints() {
       v = add_vertex(g);
-      clear_vertex(g, v);
-      remove_vertex(g, v);
-      p = add_edge(g, u, v);
-      remove_edge(g, u, v);
-      //remove_edge(g, e); // needs to be implemented -JGS
+      clear_vertex(v, g);
+      remove_vertex(v, g);
+      p = add_edge(u, v, g);
+      remove_edge(u, v, g);
+      remove_edge(e, g);
+      remove_edge(iter, g);
     }
     G g;
     edge_descriptor e;
     std::pair p;
     typename graph_traits::vertex_descriptor u, v;
+    typename graph_traits::out_edge_iterator iter;
   };
 
   template 
@@ -225,8 +227,8 @@ namespace boost {
     typedef typename graph_traits::edge_descriptor edge_descriptor;
     void constraints() {
       REQUIRE(G, MutableGraph);
-      v = add_vertex(g, vp);
-      p = add_edge(g, u, v, ep);
+      v = add_vertex(vp, g);
+      p = add_edge(u, v, ep, g);
     }
     G g;
     std::pair p;
diff --git a/include/boost/graph/transpose_graph.hpp b/include/boost/graph/transpose_graph.hpp
index 86f5bfa1..7c52b78d 100644
--- a/include/boost/graph/transpose_graph.hpp
+++ b/include/boost/graph/transpose_graph.hpp
@@ -56,7 +56,7 @@ namespace boost {
       for (boost::tie(j,jend) = out_edges(u, G); j !=jend; ++j) {
         Edge e = *j;
         Vertex v = target(e, G);
-        add_edge(G_T, vertex(get(index,v), G_T), vertex(get(index,u), G_T));
+        add_edge(vertex(get(index,v), G_T), vertex(get(index,u), G_T), G_T);
         // hmmm, what to do about edge properties?  should have an
         // add-edge(g,e) function, and have a templated edge
         // constructor -JGS
diff --git a/test/graph.cpp b/test/graph.cpp
index ec40a69d..85faf729 100644
--- a/test/graph.cpp
+++ b/test/graph.cpp
@@ -4,7 +4,7 @@
 #include 
 #include 
 
-#define VERBOSE 0
+#define VERBOSE 1
 
 #include 
 #include 
@@ -121,7 +121,7 @@ int main(int argc, char* argv[])
 
     // add_edge
     cerr << "Testing add_edge ..." << endl;
-    for (i=0; i<6; ++i) {
+    for (i=0; i < 6; ++i) {
       Vertex a, b;
       a = random_vertex(g);
       do {
@@ -132,7 +132,7 @@ int main(int argc, char* argv[])
 #endif
       Edge e;
       bool inserted;
-      boost::tie(e,inserted) = add_edge(g, a, b, current_edge_id++);
+      boost::tie(e,inserted) = add_edge(a, b, current_edge_id++, g);
 #if VERBOSE
       std::cout << "inserted: " << inserted << std::endl;
       std::cout << "source(e,g)" << source(e,g) << endl;
@@ -150,9 +150,9 @@ int main(int argc, char* argv[])
       ++E;
     }
 
-    // remove_edge
-    cerr << "Testing remove_edge ..." << endl; is_failed = false;
-    for (i = 0; i<2; ++i) {
+    // remove_edge(u, v, g)
+    cerr << "Testing remove_edge(u, v, g) ..." << endl; is_failed = false;
+    for (i = 0; i < 2; ++i) {
 #if VERBOSE
       print_edges(g, vertex_id_map);
 #endif
@@ -163,7 +163,7 @@ int main(int argc, char* argv[])
 #if VERBOSE
       cerr << "remove_edge(" << vertex_id_map[a] << "," << vertex_id_map[b] << ")" << endl;
 #endif
-      remove_edge(g, a, b);
+      remove_edge(a, b, g);
 #if VERBOSE
       print_graph(g, vertex_id_map);
       //      print_in_edges(g, vertex_id_map);
@@ -180,6 +180,41 @@ int main(int argc, char* argv[])
     } else
       cerr << "           Passed."<< endl;
 
+
+    // remove_edge(e, g)
+    cerr << "Testing remove_edge(e, g) ..." << endl; is_failed = false;
+    for (i = 0; i < 2; ++i) {
+#if VERBOSE
+      print_edges(g, vertex_id_map);
+#endif
+      Vertex a, b;
+      Edge e = random_edge(g);
+      boost::tie(a,b) = boost::incident(e, g);
+      --E;
+#if VERBOSE
+      cerr << "remove_edge(" << vertex_id_map[a] << "," << vertex_id_map[b] << ")" << endl;
+#endif
+      graph_traits::edges_size_type old_E = num_edges(g);
+      remove_edge(e, g);
+#if VERBOSE
+      print_graph(g, vertex_id_map);
+      //      print_in_edges(g, vertex_id_map);
+      print_edges(g, vertex_id_map);
+#endif
+
+      is_failed = is_failed || old_E != num_edges(g) + 1
+	|| num_edges(g) != count_edges(g);
+      if (is_failed)
+	break;
+    }
+    if ( is_failed ) {
+      ret = -1;
+      cerr << "    Failed."<< endl;
+    } else
+      cerr << "           Passed."<< endl;
+    
+    
+
     // add_vertex
     cerr << "Testing add_vertex ..." << endl; is_failed = false;
     old_N = num_vertices(g);
@@ -265,7 +300,7 @@ int main(int argc, char* argv[])
 #if VERBOSE
       cerr << "add_edge(" << vertex_id_map[vid] << "," << vertex_id_map[a] <<")" << endl;
 #endif
-      boost::tie(e,inserted) = add_edge(g, vid, a, current_edge_id++);
+      boost::tie(e,inserted) = add_edge(vid, a, EdgeID(current_edge_id++), g);
       
       if (! check_edge_added(g, e, vid, a, vertex_id_map, edge_id_map, current_edge_id - 1,
 			     inserted)) {
@@ -277,7 +312,7 @@ int main(int argc, char* argv[])
       cerr << "add_edge(" << vertex_id_map[b] << "," << vertex_id_map[vidp1] <<")" << endl;
 #endif
       // add_edge without plugin
-      boost::tie(e,inserted) = add_edge(g, b, vidp1);
+      boost::tie(e,inserted) = add_edge(b, vidp1, g);
       if (inserted)
 	edge_id_map[e] = current_edge_id;
       ++current_edge_id;
@@ -297,7 +332,7 @@ int main(int argc, char* argv[])
     //    print_in_edges(g, vertex_id_map);
     cerr << "clearing vertex " << vertex_id_map[c] << endl;
 #endif
-    clear_vertex(g, c);
+    clear_vertex(c, g);
 #if VERBOSE
     print_graph(g, vertex_id_map);
     //    print_in_edges(g, vertex_id_map);
@@ -317,7 +352,7 @@ int main(int argc, char* argv[])
 #endif
 
     old_N = num_vertices(g);
-    remove_vertex(g, c);
+    remove_vertex(c, g);
 #if VERBOSE
     print_graph(g,vertex_id_map);
     //    print_in_edges(g,vertex_id_map);
diff --git a/test/graph_type.hpp b/test/graph_type.hpp
index 6832df1e..f43dd768 100644
--- a/test/graph_type.hpp
+++ b/test/graph_type.hpp
@@ -1,2 +1,4 @@
 #include 
-typedef boost::adjacency_list, boost::property > Graph;
+typedef boost::adjacency_list, boost::property > Graph;
+typedef boost::property VertexId;
+typedef boost::property EdgeID;
add_edge(g, u, v)add_edge(u, v, g) Inserts the edge (u,v) into the graph.
Return type: std::pair<edge_descriptor, bool> @@ -69,7 +69,7 @@ Return type: std::pair<edge_descriptor, bool>
remove_edge(g, u, v)remove_edge(u, v, g) Remove the edge (u,v) from the graph. If the graph allows parallel edges this remove all occurances of @@ -82,7 +82,7 @@ Postcondition: (u,v) is no longer in the edge set for
remove_edge(g, e)remove_edge(e, g) Remove the edge e from the graph.
Return type: void<>
Precondition: e is an edge in the graph.
@@ -100,7 +100,7 @@ Return type: vertex_descriptor
clear_vertex(g, u)clear_vertex(u, g) Remove all edges to and from vertex u from the graph.
Return type: void
@@ -111,7 +111,7 @@ any edge in g.
remove_vertex(g, u)remove_vertex(u, g) Remove u from the vertex set of the graph. Note that undefined behaviour may result if there are edges remaining in the graph who's @@ -165,16 +165,18 @@ is no longer a valid vertex descriptor. typedef typename boost::graph_traits<G>::edge_descriptor edge_descriptor; void constraints() { v = add_vertex(g); - clear_vertex(g, v); - remove_vertex(g, v); - p = add_edge(g, u, v); - remove_edge(g, u, v); - remove_edge(g, e); + clear_vertex(v, g); + remove_vertex(v, g); + p = add_edge(u, v, g); + remove_edge(u, v, g); + remove_edge(e, g); + remove_edge(iter, g); } G g; edge_descriptor e; std::pair<edge_descriptor, bool> p; typename boost::graph_traits<G>::vertex_descriptor u, v; + typename boost::graph_traits<G>::out_edge_iterator iter; }; diff --git a/docs/adjacency_list.html b/docs/adjacency_list.html index 4e410c6a..25d14cfc 100644 --- a/docs/adjacency_list.html +++ b/docs/adjacency_list.html @@ -84,12 +84,12 @@ href="../examples/family_tree.cpp">examples/family_tree.cpp. name[Benjamin] = "Benjamin"; adjacency_list<> G(N); - add_edge(G, Jeanie, Debbie); - add_edge(G, Jeanie, Rick); - add_edge(G, Jeanie, John); - add_edge(G, Debbie, Amanda); - add_edge(G, Rick, Margaret); - add_edge(G, John, Benjamin); + add_edge(Jeanie, Debbie, G); + add_edge(Jeanie, Rick, G); + add_edge(Jeanie, John, G); + add_edge(Debbie, Amanda, G); + add_edge(Rick, Margaret, G); + add_edge(John, Benjamin, G); graph_traits< adjacency_list<> >::vertex_iterator i, end; graph_traits< adjacency_list<> >::adjacency_iterator ai, a_end; @@ -501,8 +501,8 @@ graph g.
 std::pair<edge_descriptor, bool>
-add_edge(adjacency_list& g, 
-         vertex_descriptor u, vertex_descriptor v)
+add_edge(vertex_descriptor u, vertex_descriptor v,
+         adjacency_list& g)
 
Adds edge (u,v) to the graph and returns the edge descriptor for the new edge. For graphs that do not allow parallel edges, if the @@ -528,9 +528,9 @@ Adjacency List Storage).
 std::pair<edge_descriptor, bool>
-add_edge(adjacency_list& g,
-         vertex_descriptor u, vertex_descriptor v,
-         const EdgeProperty& p)
+add_edge(vertex_descriptor u, vertex_descriptor v,
+         const EdgeProperty& p,
+         adjacency_list& g)
 
Adds edge (u,v) to the graph and attaches p as the value of the edge's internal property storage. Also see the previous @@ -539,13 +539,61 @@ value of the edge's internal property storage. Also see the previous
-void remove_edge(adjacency_list& g,
-                 vertex_descriptor v, vertex_descriptor u)
+void remove_edge(vertex_descriptor v, vertex_descriptor u, 
+                 adjacency_list& g)
 
-Removes the edge (v,u) from the graph. -If the EdgeList selector is vecS then this operation -will invalidate any iterators that point into the edge-list for vertex -u. +Removes the edge (v,u) from the graph. If the +EdgeList selector is vecS then this operation will +invalidate any iterators that point into the edge-list for +vertex u and for vertex v in the undirected and +bidirectional case. + +
+ +
+void remove_edge(edge_descriptor e, adjacency_list& g)
+
+Removes the edge e from the graph. This differs from the +remove_edge(u, v, g) function in the case of a +multigraph. This remove_edge(e, g) function removes a single +edge, whereas the remove_edge(u, v, g) function removes all +edges (u,v). If the EdgeList selector is +vecS then this operation will invalidate any iterators +that point into the edge-list for vertex u and for vertex +v in the undirected and bidirectional case. + + +
+ +
+void remove_edge(out_edge_iterator iter, adjacency_list& g)
+
+This has the same effect as remove_edge(*iter, g). The +difference is that this function has constant time complexity +in the case of directed graphs. + +
+ +
+template <class Predicate>
+void remove_out_edge_if(vertex_descriptor v, Predicate predicate,
+                        adjacency_list& g)
+
+Removes all out-edges of vertex v from the graph that satisfy +the predicate. That is, if the predicate returns true when +applied to the edge, then the edge is removed. + +
+ +
+template <class Predicate>
+void remove_in_edge_if(vertex_descriptor v, Predicate predicate,
+                       adjacency_list& g)
+
+Removes all in-edges of vertex v from the graph that satisfy +the predicate. That is, if the predicate returns true when +applied to the edge, then the edge is removed. +
@@ -570,7 +618,7 @@ in the vertex set of the graph.
-void remove_vertex(adjacency_list& g, vertex_descriptor u)
+void remove_vertex(vertex_descriptor u, adjacency_list& g)
 
Remove vertex u from the vertex set of the graph. It is assumed that there are no edges to or from vertex u when it is removed. diff --git a/docs/connected_components.html b/docs/connected_components.html index a1afd062..8e4b2990 100644 --- a/docs/connected_components.html +++ b/docs/connected_components.html @@ -178,14 +178,14 @@ href="../examples/connected_components.cpp">examples/connected_components.cp typedef discover_time_property< finish_time_property < color_property<> > > VertexProperty; typedef adjacency_list <vecS, vecS, undirectedS, VertexProperty> Graph; - typedef Graph::vertex_descriptor Vertex; + typedef graph_traits<Graph>::vertex_descriptor Vertex; const int N = 6; Graph G(N); - add_edge(G, 0, 1); - add_edge(G, 1, 4); - add_edge(G, 4, 0); - add_edge(G, 2, 5); + add_edge(0, 1, G); + add_edge(1, 4, G); + add_edge(4, 0, G); + add_edge(2, 5, G); std::vector<int> c(num_vertices(G)); int num = connected_components(G, c.begin(), @@ -218,16 +218,16 @@ Calculating the strongly connected components of a directed graph. typedef adjacency_list< vecS, vecS, directedS, VertexProperty > Graph; const int N = 6; Graph G(N); - add_edge(G, 0, 1); - add_edge(G, 1, 1); - add_edge(G, 1, 3); - add_edge(G, 1, 4); - add_edge(G, 4, 3); - add_edge(G, 3, 4); - add_edge(G, 3, 0); - add_edge(G, 5, 2); + add_edge(0, 1, G); + add_edge(1, 1, G); + add_edge(1, 3, G); + add_edge(1, 4, G); + add_edge(4, 3, G); + add_edge(3, 4, G); + add_edge(3, 0, G); + add_edge(5, 2, G); - typedef Graph::vertex_descriptor Vertex; + typedef graph_traits<Graph>::vertex_descriptor Vertex; std::vector<int> c(N); int num = connected_components(G, c.begin(), diff --git a/docs/dynamic_connected_components.html b/docs/dynamic_connected_components.html index 42488652..6fe72de9 100644 --- a/docs/dynamic_connected_components.html +++ b/docs/dynamic_connected_components.html @@ -94,8 +94,8 @@ href="../examples/dynamic_components.cpp">examples/dynamic_components.cppexamples/dynamic_components.cpp
-  add_edge(g, bar_cpp, dax_h);
+  add_edge(bar_cpp, dax_h, g);
 
diff --git a/docs/graph_concepts.html b/docs/graph_concepts.html index 61a1983e..24e17311 100644 --- a/docs/graph_concepts.html +++ b/docs/graph_concepts.html @@ -91,6 +91,11 @@ each of the concepts. The notation used in the table is as follows.
An object of type boost::graph_traits<G>::edge_descriptor.
e_iterAn object of type boost::graph_traits<G>::out_edge_iterator.
u,v Are objects of type boost::graph_traits<G>::vertex_descriptor. vertex_descriptor
-clear_vertex(g, v) void
-remove_vertex(g, v) void
-add_edge(g, u, v) std::pair<edge_descriptor, bool>
-remove_edge(g, u, v) void
-remove_edge(g, e) void
+remove_edge(e_iter, g) void
-add_vertex(g, vp) vertex_descriptor
-add_edge(g, u, v, ep) std::pair<edge_descriptor, bool>