(require "graph-view")
(require "graphics")
(require "flash")

(define g (graph '(a b c d) 
                           '((a c) (a c) (a d) (a d) (b c) (b d) (c d))))
(define vxcoords (list->vector '(0.1 0.9 0.5 0.5)))
(define vycoords (list->vector '(0.5 0.5 0.1 0.9)))

(define gv (make <graph-view> :wxcoords vxcoords :wycoords vycoords :graph g))

(define eg (edges gv))

(define e0 (list-ref eg 0))
(define e1 (list-ref eg 1))
(define e2 (list-ref eg 2))
(define e3 (list-ref eg 3))
(define e4 (list-ref eg 4))
(define e5 (list-ref eg 5))
(define e6 (list-ref eg 6))

(define ecycle (list e0 e1 e2 e5 e4 e6 e3))

(define (show-cycle1)
	(map (lambda (x) 
		(jiggle x) 
		(set! (color x) "red")
		(set! (text-color x) "green")
		(set! (width x) 4)
		(set! (font x) "-*-times-bold-i-normal--24-180-*-*-*-*-*-*"))
 			ecycle))
(define (show-cycle2)
	(map (lambda (x) 
		(jiggle x) 
		(set! (color x) "black")
		(set! (text-color x) "black")
		(set! (width x) 1)
	(set! (font x) "-Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-*"))
 			ecycle))

(define (show-cycle)
	(show-cycle1)
	(show-cycle2) #f)

(define (random-edge-weights g)
        (let ((eg (set-edge->list (edges g))))
                (map (lambda (x)
                        (let ((r(string->number (number->string (random 100)))))
                                (set-attribute! 'weight r x))) eg)) #f)

(random-edge-weights g)

(define (show-edge-weights g)
        (let ((eg (set-edge->list (edges g))))
                (map (lambda (x) (find-attribute 'weight x)) eg)))


(provide "euler")
