From 5282d117ab0e8b7080bca9683e270f0d2a8f4d5c Mon Sep 17 00:00:00 2001 From: Gary King Date: Thu, 27 Apr 2006 09:35:21 -0400 Subject: [PATCH] Improved efficiency of edge-count for graphs in general (from (length (graph-edges ...)) to (count-using ...)) and for graph-containers in particular (just use size). darcs-hash:20060427133521-3cc5d-07b4bcedb22efc1e6badfcc16c3b9c9e76d44fa1.gz --- dev/graph-container.lisp | 8 ++++---- dev/graph.lisp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/graph-container.lisp b/dev/graph-container.lisp index afafdda..0865b2f 100644 --- a/dev/graph-container.lisp +++ b/dev/graph-container.lisp @@ -208,7 +208,6 @@ DISCUSSION ;;; --------------------------------------------------------------------------- - (defmethod find-edge ((graph graph-container) (edge graph-container-edge) &optional error-if-not-found?) (find-edge-between-vertexes @@ -312,7 +311,8 @@ DISCUSSION (values nil)) +;;; --------------------------------------------------------------------------- + +(defmethod edge-count ((graph graph-container)) + (size (graph-edges graph))) -;;; *************************************************************************** -;;; * End of File * -;;; *************************************************************************** \ No newline at end of file diff --git a/dev/graph.lisp b/dev/graph.lisp index a8f782b..b2c1cf3 100644 --- a/dev/graph.lisp +++ b/dev/graph.lisp @@ -1065,7 +1065,7 @@ nil gathers the entire closure(s)." ;;; --------------------------------------------------------------------------- (defmethod edge-count ((graph basic-graph)) - (length (edges graph))) + (count-using #'iterate-edges nil graph)) ;;; --------------------------------------------------------------------------- -- 1.7.10.4