Use records instead of conss for nodes, alist for graphs
This commit is contained in:
23
demo.scm
23
demo.scm
@@ -1,19 +1,10 @@
|
||||
(use-modules (graphgif))
|
||||
(use-modules (graphgif)
|
||||
(srfi srfi-9 gnu)
|
||||
(ice-9 copy-tree))
|
||||
|
||||
(define red (create-color 1 0 0))
|
||||
|
||||
(define my-graph
|
||||
`(((10 . 10) (1))
|
||||
((30 . 20) () ,red)))
|
||||
|
||||
(define more-complex-graph
|
||||
`(((10 . 10) ())
|
||||
((40 . 10) (0))
|
||||
((25 . 25) (0 1))
|
||||
((10 . 40) (0 2 4))
|
||||
((40 . 40) (1 2 3))))
|
||||
|
||||
(let* ([graph1 (generate-web 10 10)]
|
||||
[graph2 (list-copy graph1)])
|
||||
(set-car! graph2 (append (car graph2) `(,red)))
|
||||
(write-graphs-to-file (list graph1 graph2) "graph.gif"))
|
||||
(define graph1 (generate-web 10 10))
|
||||
(define graph2 (copy-tree graph1))
|
||||
(assq-set! graph2 0 (set-node-color (assq-ref graph2 0) red))
|
||||
(write-graphs-to-file (list graph1 graph2) "graph.gif")
|
||||
|
||||
Reference in New Issue
Block a user