Skip to content

mnasoft/mnas-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

133 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mnas-Graph

1 Purpose

This project defines the basic functions for creating and displaying a data structure of the Graph type.

The transformation of the Graph into a format suitable for visualization is carried out using the Graphviz program.

2 Examples

2.1 Example 1

(mnas-graph/view:view-graph
  (mnas-graph:make-graph
   '(("a" "b") ("a" "c") ("a" "d") ("b" "c") ("c" "d"))))

2.2 Example 2

(let*
     ((g  (make-instance 'mnas-graph:<graph>))
      (v1 (make-instance 'mnas-graph:<node> :owner g :name "v1"))
      (v2 (make-instance 'mnas-graph:<node> :owner g :name "v2"))
      (v3 (make-instance 'mnas-graph:<node> :owner g :name "v3"))
      (r1 (make-instance 'mnas-graph:<edge> :tail v1 :head v2))
      (r2 (make-instance 'mnas-graph:<edge> :tail v2 :head v3))
      (r3 (make-instance 'mnas-graph:<edge> :tail v3 :head v1)))
   (mnas-graph:insert-to v1 g)
   (mnas-graph:insert-to v2 g)
   (mnas-graph:insert-to v3 g)
   (mnas-graph:insert-to r1 g)
   (mnas-graph:insert-to r2 g)
   (mnas-graph:insert-to r3 g)
   (mnas-graph/view:view-graph g))

2.3 Example 3

(mnas-graph/demos:demo-6)