6 local function printf(fmt
, ...)
7 print(string.format(fmt
, ...))
13 local node
, edge
, subgraph
, cluster
, digraph
, strictdigraph
, graph
=
14 gr
.node
, gr
.edge
, gr
.subgraph
, gr
.cluster
, gr
.digraph
, gr
.strictdigraph
, gr
.graph
17 -- The definition of a graph
23 comment
= "LuaGraph: exam2.lua",
33 edge
{"toni", "jupp", label
="brothers"},
34 edge
{"peter", "toni", label
="father"},
35 edge
{"peter", "jupp", label
="father"},
36 edge
{"maria", "toni", label
="mother"},
37 edge
{"maria", "jupp", label
="mother"}
47 node
{"berlin", fillcolor
="blue"},
50 ltail
= "cluster_mueller",
55 lhead
= "cluster_meier",
59 "peter", "eva", label
="daughter"
62 "maria", "eva", label
="daughter"
74 -- Render the graph into postscript format
78 g
:render("ps", "out.ps")
79 g
:render("gif", "out.gif")
80 g
:render("svg", "out.svg")
81 g
:render("png", "out.png")