All pastes #753976 Raw Edit

Stuff

public text v1 · immutable
#753976 ·published 2007-10-29 18:04 UTC
rendered paste body
(defun generate-graph ()
  (with-open-file (str path :direction :input)
    (read-line str) ;; to skip the first line (i don't need it ;;
    (let ((graph-name (make-graph 'graph-container)))
      (do ((l (read-line str) (read-line str nil :eof)))
	  ((string= l "}"))
	(let ((trimmed-line (string-trim " \"" l)))
	  (cond ((find #\! trimmed-line)  ;; to be changed
		 (add-vertex 
		  graph-name 
		  (intern (string-trim " \"" (subseq trimmed-line 0 
						     (- (search "pos" trimmed-line) 2)
							 )))));;to be changed
		;; i should add an (or)
		((search "--" trimmed-line)
		 (print trimmed-line)
		 (let* ((trimmed-line (delete #\" trimmed-line))
			(v1 (intern (subseq trimmed-line 0 (position #\- trimmed-line))))
			(v2 (intern (subseq trimmed-line 
					    (+ 2(search "--" trimmed-line))
					    (- (position #\[ trimmed-line) 1)
						))) ;;to be changed/add an (or)
			(val nil));; to be changed
		   (add-edge-between-vertexes graph-name v1 v2 :value val)))))) ;; do something)
      graph-name)))