6 local function printf(fmt
, ...)
7 print(string.format(fmt
, ...))
13 local node
, edge
, subgraph
, cluster
, digraph
, strictdigraph
=
14 gr
.node
, gr
.edge
, gr
.subgraph
, gr
.cluster
, gr
.digraph
, gr
.strictdigraph
17 -- The definition of a graph
19 local g
= strictdigraph
{"G",
23 comment
= "LuaGraph: exam2.lua",
26 node
{"n1", comment
="123"},
41 edge
{"n1", "m2", ltail
="cluster_c1", lhead
="cluster_c2", label
="comp"},
42 edge
{"n1","o1", "m1", label
="nom"}
47 -- Render the graph into postscript format
51 g
:render("ps", "out.ps")
52 g
:render("gif", "out.gif")
53 g
:render("svg", "out.svg")
54 g
:render("png", "out.png")