From: Andrej V. <an...@us...> - 2008-11-12 09:15:39
|
Update of /cvsroot/maxima/maxima/share/contrib/graphs In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18415/share/contrib/graphs Modified Files: graph_core.lisp Log Message: Added graph_join function Index: graph_core.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/share/contrib/graphs/graph_core.lisp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- graph_core.lisp 3 Nov 2008 09:44:14 -0000 1.20 +++ graph_core.lisp 12 Nov 2008 09:15:31 -0000 1.21 @@ -825,6 +825,23 @@ (add-edge (list (+ n (first e)) (+ n (second e))) g)) g)) +(defun $graph_join (g1 g2) + (require-graph 'graph_join 1 g1) + (require-graph 'graph_join 2 g2) + (let ((g (make-graph)) (n (1+ (apply #'max (graph-vertices g1))))) + (dolist (v (graph-vertices g1)) + (add-vertex v g)) + (dolist (e (graph-edges g1)) + (add-edge e g)) + (dolist (v (graph-vertices g2)) + (add-vertex (+ n v) g)) + (dolist (e (graph-edges g2)) + (add-edge (list (+ n (first e)) (+ n (second e))) g)) + (dolist (v (graph-vertices g1)) + (dolist (u (graph-vertices g2)) + (add-edge (list v (+ n u)) g))) + g)) + (defun get-canonical-names (l) (let ((names ()) (i 0)) (dolist (v l) |