FEAT: Add StableGraph::clear_edges
diff --git a/src/graph_impl/stable_graph/mod.rs b/src/graph_impl/stable_graph/mod.rs
index e0db3d5..294c420 100644
--- a/src/graph_impl/stable_graph/mod.rs
+++ b/src/graph_impl/stable_graph/mod.rs
@@ -212,6 +212,19 @@
         self.g.clear();
     }
 
+    /// Remove all edges
+    pub fn clear_edges(&mut self) {
+        self.edge_count = 0;
+        self.free_edge = EdgeIndex::end();
+        self.g.edges.clear();
+        // clear edges without touching the free list
+        for node in &mut self.g.nodes {
+            if let Some(_) = node.weight {
+                node.next = [EdgeIndex::end(), EdgeIndex::end()];
+            }
+        }
+    }
+
     /// Return the number of nodes (vertices) in the graph.
     ///
     /// Computes in **O(1)** time.
diff --git a/tests/stable_graph.rs b/tests/stable_graph.rs
index 046587b..bc6b034 100644
--- a/tests/stable_graph.rs
+++ b/tests/stable_graph.rs
@@ -46,6 +46,18 @@
     assert_eq!(g.node_bound(), 0);
 }
 
+#[test]
+fn clear_edges() {
+    let mut gr = scc_graph();
+    gr.remove_node(n(1));
+    gr.clear_edges();
+    // check that we use the free list for the vacancies
+    assert_eq!(gr.add_node(()), n(1));
+    assert_eq!(gr.add_node(()), n(4));
+    assert!(gr.edge_references().next().is_none());
+    assert!(gr.node_indices().all(|i| gr.neighbors(i).next().is_none()));
+}
+
 fn assert_sccs_eq(mut res: Vec<Vec<NodeIndex>>, normalized: Vec<Vec<NodeIndex>>) {
     // normalize the result and compare with the answer.
     for scc in &mut res {