added delete-all-edges
authorGary King <gwking@metabang.com>
Sat, 1 Jul 2006 23:55:19 +0000 (19:55 -0400)
committerGary King <gwking@metabang.com>
Sat, 1 Jul 2006 23:55:19 +0000 (19:55 -0400)
darcs-hash:20060701235519-3cc5d-0037bd7ff5a1e4d06db185fb64270a7ddb48ee46.gz

dev/graph-container.lisp
dev/graph.lisp
dev/package.lisp

index 544a0c4..345ee48 100644 (file)
@@ -237,6 +237,14 @@ DISCUSSION
                   :test #'eq)))
   edge)
 
+(defmethod delete-all-edges ((graph graph-container))
+  (iterate-vertexes 
+   graph
+   (lambda (vertex)
+     (empty! (vertex-edges vertex))))
+  (empty! (vertex-pair->edge graph))
+  graph)
+
 ;;; ---------------------------------------------------------------------------
 
 (defmethod empty! :after ((graph graph-container))
index c41e463..caa6cb6 100644 (file)
@@ -481,6 +481,11 @@ something is putting something on the vertexes plist's
   (delete-item (graph-edges graph) edge)
   edge)
 
+
+(defmethod delete-all-edges :after ((graph basic-graph))
+  (empty! (graph-edges graph))
+  graph)
+
 ;;; ---------------------------------------------------------------------------
 
 (defmethod delete-vertex ((graph basic-graph) value-or-vertex)
index e117799..f0f28d5 100644 (file)
@@ -96,7 +96,8 @@ DISCUSSION
    
    #:add-edge                      ; graph edge
    #:delete-edge                   ; graph edge
-   
+   #:delete-all-edges
+
    #:add-vertex                    ; graph { value | vertex }
    #:delete-vertex                 ; graph { value | vertex }
    #:find-vertex                   ; graph { value | vertex }