From a196e72eb584440a594f0665ff5c97037ce4cf70 Mon Sep 17 00:00:00 2001 From: Gary King Date: Tue, 21 Mar 2006 09:51:05 -0500 Subject: [PATCH] Gnp -> gnp; Gnm -> gnm, etc for mlisp happiness darcs-hash:20060321145105-3cc5d-1a4a755ec40859ad3a253db3c8edf6513843de81.gz --- dev/api.lisp | 4 ++-- dev/graph-algorithms.lisp | 2 +- dev/graph-generation.lisp | 20 ++++++++++---------- dev/graph.lisp | 2 +- dev/graphviz/graphviz-support.lisp | 2 ++ 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/dev/api.lisp b/dev/api.lisp index 42dac55..5e0f672 100644 --- a/dev/api.lisp +++ b/dev/api.lisp @@ -312,12 +312,12 @@ For more information about DOT file format, search the web for 'DOTTY' and ;;; --------------------------------------------------------------------------- -(defgeneric generate-Gnm (generator graph n m &key) +(defgeneric generate-gnm (generator graph n m &key) (:documentation "Generate a 'classic' random graph G(n, m) with n vertexes and m edges.")) ;;; --------------------------------------------------------------------------- -(defgeneric generate-Gnp (generator graph n p &key) +(defgeneric generate-gnp (generator graph n p &key) (:documentation "Generate the Erd\"os-R\'enyi random graph G\(n, p\). I.e., a graph with n vertexes where each possible edge appears with probability p. This implementation is from Efficient Generation of Large Random Networks \(see batagelj-generation-2005 in doab\).")) diff --git a/dev/graph-algorithms.lisp b/dev/graph-algorithms.lisp index 9ee37a8..6230047 100644 --- a/dev/graph-algorithms.lisp +++ b/dev/graph-algorithms.lisp @@ -4,7 +4,7 @@ ;;; ;;; --------------------------------------------------------------------------- -(defstruct (vertex-datum (:conc-name "NODE-") (:type list)) +(defstruct (vertex-datum (:conc-name node-) (:type list)) (color nil) (depth most-positive-fixnum) (parent nil)) diff --git a/dev/graph-generation.lisp b/dev/graph-generation.lisp index 90f1f5d..1638596 100644 --- a/dev/graph-generation.lisp +++ b/dev/graph-generation.lisp @@ -1,8 +1,8 @@ (in-package metabang.graph) (eval-when (:compile-toplevel :load-toplevel :execute) - (export '(generate-Gnp - generate-Gnm + (export '(generate-gnp + generate-gnm generate-undirected-graph-via-assortativity-matrix generate-undirected-graph-via-vertex-probabilities generate-multi-group-graph-fixed @@ -60,16 +60,16 @@ ;;; --------------------------------------------------------------------------- -;;; generate-Gnp +;;; generate-gnp ;;; --------------------------------------------------------------------------- -(defmethod generate-Gnp (generator (graph-class symbol) n p &key (label 'identity)) - (generate-Gnp +(defmethod generate-gnp (generator (graph-class symbol) n p &key (label 'identity)) + (generate-gnp generator (make-instance graph-class) n p :label label)) ;;; --------------------------------------------------------------------------- -(defmethod generate-Gnp (generator (graph basic-graph) n p &key (label 'identity)) +(defmethod generate-gnp (generator (graph basic-graph) n p &key (label 'identity)) (let ((v 1) (w -1) (log-1-p (log (- 1 p)))) @@ -89,16 +89,16 @@ graph)) ;;; --------------------------------------------------------------------------- -;;; generate-Gnm +;;; generate-gnm ;;; --------------------------------------------------------------------------- -(defmethod generate-Gnm (generator (graph-class symbol) n p &key (label 'identity)) - (generate-Gnm +(defmethod generate-gnm (generator (graph-class symbol) n p &key (label 'identity)) + (generate-gnm generator (make-instance graph-class) n p :label label)) ;;; --------------------------------------------------------------------------- -(defmethod generate-Gnm (generator (graph basic-graph) n m &key (label 'identity)) +(defmethod generate-gnm (generator (graph basic-graph) n m &key (label 'identity)) (let ((max-edge-index (1- (combination-count n 2)))) (assert (<= m max-edge-index)) #+Ignore diff --git a/dev/graph.lisp b/dev/graph.lisp index 8a7bd94..e0c5aee 100644 --- a/dev/graph.lisp +++ b/dev/graph.lisp @@ -198,7 +198,7 @@ something is putting something on the vertexes plist's (defmethod print-object ((graph basic-graph) stream) (print-unreadable-object (graph stream :type t :identity t) - (format stream "~A" (size graph)))) + (format stream "[~A,~A]" (size graph) (edge-count graph)))) ;;; --------------------------------------------------------------------------- diff --git a/dev/graphviz/graphviz-support.lisp b/dev/graphviz/graphviz-support.lisp index 63cd048..26a35bf 100644 --- a/dev/graphviz/graphviz-support.lisp +++ b/dev/graphviz/graphviz-support.lisp @@ -87,9 +87,11 @@ This file contains the stuff that does not depend on cl-graphviz. (iterate-vertexes g (lambda (v) + ;(spy v) (iterate-edges v (lambda (e) + ;(spy e (undirected-edge-p e) (item-at-1 edges e)) (when (and (undirected-edge-p e) (not (item-at-1 edges e))) (setf (item-at-1 edges e) t) -- 1.7.10.4