Improved efficiency of edge-count for graphs in general (from (length (graph-edges...
authorGary King <gwking@metabang.com>
Thu, 27 Apr 2006 13:35:21 +0000 (09:35 -0400)
committerGary King <gwking@metabang.com>
Thu, 27 Apr 2006 13:35:21 +0000 (09:35 -0400)
darcs-hash:20060427133521-3cc5d-07b4bcedb22efc1e6badfcc16c3b9c9e76d44fa1.gz

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

index afafdda..0865b2f 100644 (file)
@@ -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
index a8f782b..b2c1cf3 100644 (file)
@@ -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))
 
 ;;; ---------------------------------------------------------------------------