fixed version in rockspec
[luagraph.git] / examples / neato.lua
blob0cc9c25f53d1daa2d5edb938f25bd77fa3978ba4
1 gr = require "graph"
3 --
4 -- For simple formatted printing
5 --
6 local function printf(fmt, ...)
7 print(string.format(fmt, ...))
8 end
10 local function gshow(g)
11 local fn = os.tmpname() .. ".dot"
12 g:write(fn)
13 os.execute("dotty "..fn)
14 os.remove(fn)
15 end
17 -- Provide simple reference for frequently used functions (optional)
18 node, edge, subgraph, cluster, digraph, strictdigraph =
19 gr.node, gr.edge, gr.subgraph, gr.cluster, gr.digraph, gr.strictdigraph
21 local f, err = assert(loadfile(arg[1]))
22 local g = f()
24 printf("Generated 'dot' format:")
25 g:write()
26 gshow(g)
27 g:close()