Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/graphviz|the CHICKEN 5 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. == graphviz Some Graphviz abstractions [[toc:]] === {{default-width}} <parameter>default-width → 1600</parameter> Default width for graphs <enscript highlight="scheme">(define default-width (make-parameter 1600)) </enscript> === {{default-height}} <parameter>default-height → 900</parameter> Default width for graphs <enscript highlight="scheme">(define default-height (make-parameter 900)) </enscript> === {{default-font-size}} <parameter>default-font-size → 48.0</parameter> Default font-size for graphs <enscript highlight="scheme">(define default-font-size (make-parameter 48.0)) </enscript> === {{default-node-attributes}} <parameter>default-node-attributes → (quote ())</parameter> Default node attributes <enscript highlight="scheme">(define default-node-attributes (make-parameter '())) </enscript> ==== Examples Creating default node attributes (default-node-attributes '((font . monospace))) === {{default-edge-attributes}} <parameter>default-edge-attributes → (quote ())</parameter> Default edge attributes <enscript highlight="scheme">(define default-edge-attributes (make-parameter '())) </enscript> ==== Examples Creating default edge attributes (default-edge-attributes '((dir . none))) === {{default-graph-attributes}} <parameter>default-graph-attributes → (quote ())</parameter> Default graph attributes <enscript highlight="scheme">(define default-graph-attributes (make-parameter '())) </enscript> ==== Examples Creating default graph attributes (default-graph-attributes '((splines . true))) === {{write-graph-preamble}} <procedure>(write-graph-preamble) → unspecified</procedure> <procedure>(write-graph-preamble graph-attributes) → unspecified</procedure> <procedure>(write-graph-preamble graph-attributes width height font-size) → unspecified</procedure> Write a graph preamble. ; {{graph-attributes}} : Attributes of the graph ; {{width}} : Width in pixels ; {{height}} : Height in pixels ; {{font-size}} : Font-size in pt <enscript highlight="scheme">(define write-graph-preamble (case-lambda (() (write-graph-preamble '())) ((graph-attributes) (write-graph-preamble graph-attributes (default-width) (default-height) (default-font-size))) ((graph-attributes width height font-size) (display "digraph G {") (unless (null? graph-attributes) (format #t "graph [~a];" (attributes->string graph-attributes))) (unless (null? (default-graph-attributes)) (format #t "graph [~a];" (attributes->string (default-graph-attributes)))) (unless (null? (default-node-attributes)) (format #t "node [~a];" (attributes->string (default-node-attributes)))) (unless (null? (default-edge-attributes)) (format #t "edge [~a];" (attributes->string (default-edge-attributes)))) (if (and width height) (begin (format #t "graph [fontsize=~a, ratio=fill];" font-size) (let ((width-in-inches (px->in width)) (height-in-inches (px->in height))) (format #t "graph [viewport=\"~a,~a\", size=\"~a,~a!\"];" (in->dot width-in-inches) (in->dot height-in-inches) width-in-inches height-in-inches))))))) </enscript> ==== Examples A trivial graph (write-graph-preamble '((splines . true))) (write-node a '((label . "Big bang"))) (write-node b '((label . "Today"))) (write-edge a b '((label . "Entropy gradient"))) (write-graph-postamble) === {{write-graph-postamble}} <procedure>(write-graph-postamble) → unspecified</procedure> Write the graph postamble. <enscript highlight="scheme">(define (write-graph-postamble) (display "}")) </enscript> === {{pos}} <procedure>(pos x y) → unspecified</procedure> For placing nodes at specific positions in a unit graph using the {{pos}} attribute, apply a linear scaling. ; {{x}} : The x position ; {{y}} : The y position <enscript highlight="scheme">(define (pos x y) (format "~a,~a" (* x (linear-scale)) (* y (linear-scale)))) </enscript> === {{write-node}} <procedure>(write-node label) → unspecified</procedure> <procedure>(write-node label attributes) → unspecified</procedure> Write a node ; {{label}} : The node's label ; {{attributes}} : Attributes of the node <enscript highlight="scheme">(define write-node (case-lambda ((label) (write-node label '())) ((label attributes) (format #t "~a [~a];" label (attributes->string attributes))))) </enscript> === {{write-edge}} <procedure>(write-edge whence whither) → unspecified</procedure> <procedure>(write-edge whence whither attributes) → unspecified</procedure> Write an edge ; {{whence}} : The label whence ; {{whither}} : The lable whither ; {{attributes}} : Attributes of the edge <enscript highlight="scheme">(define write-edge (case-lambda ((whence whither) (write-edge whence whither '())) ((whence whither attributes) (format #t "~a -> ~a [~a];" whence whither (attributes->string attributes))))) </enscript> === About this egg ==== Author [[/users/klutometis|Peter Danenberg]] ==== Repository [[https://github.com/klutometis/graphviz]] ==== License BSD ==== Dependencies * [[hahn]] * [[matchable]] * [[setup-helper]] ==== Versions ; [[https://github.com/klutometis/graphviz/releases/tag/0.2|0.2]] : Add dependencies. ; [[https://github.com/klutometis/graphviz/releases/tag/0.3|0.3]] : Get rid of 0.1. ; [[https://github.com/klutometis/graphviz/releases/tag/0.4|0.4]] : Abstract out attributes. ; [[https://github.com/klutometis/graphviz/releases/tag/0.5|0.5]] : Add test-exit. ; [[https://github.com/klutometis/graphviz/releases/tag/0.6|0.6]] : Add attributes to edge. ; [[https://github.com/klutometis/graphviz/releases/tag/0.7|0.7]] : Sparser defaults ; [[https://github.com/klutometis/graphviz/releases/tag/0.8|0.8]] : Write-graph-preamble, &c. ; [[https://github.com/klutometis/graphviz/releases/tag/0.8.1|0.8.1]] : Use hahn. ; [[https://github.com/klutometis/graphviz/releases/tag/0.8.2|0.8.2]] : Version should be a string. ==== Colophon Documented by [[/egg/hahn|hahn]].
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 15 to 0?