From 24c645986ed5cc5b0b26605cbe2f44873870a624 Mon Sep 17 00:00:00 2001 From: Gary King Date: Sat, 1 Jul 2006 19:55:19 -0400 Subject: [PATCH] added delete-all-edges darcs-hash:20060701235519-3cc5d-0037bd7ff5a1e4d06db185fb64270a7ddb48ee46.gz --- dev/graph-container.lisp | 8 ++++++++ dev/graph.lisp | 5 +++++ dev/package.lisp | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dev/graph-container.lisp b/dev/graph-container.lisp index 544a0c4..345ee48 100644 --- a/dev/graph-container.lisp +++ b/dev/graph-container.lisp @@ -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)) diff --git a/dev/graph.lisp b/dev/graph.lisp index c41e463..caa6cb6 100644 --- a/dev/graph.lisp +++ b/dev/graph.lisp @@ -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) diff --git a/dev/package.lisp b/dev/package.lisp index e117799..f0f28d5 100644 --- a/dev/package.lisp +++ b/dev/package.lisp @@ -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 } -- 1.7.10.4