;;; ---------------------------------------------------------------------------
-(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\)."))
(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
;;; ---------------------------------------------------------------------------
-;;; 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))))
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
(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))))
;;; ---------------------------------------------------------------------------