Create CODE_OF_CONDUCT.md
[luagraph.git] / examples / graphs / random.lua
blobe09854bfcd1e1e9106c97a93d13cf615416d1401
1 local edges = {}
2 local random = math.random
3 math.randomseed(os.time())
4 local N = 20
5 for i = 1, N do
6 table.insert(edges, edge{"n"..tostring(random(1,N/2)), "n"..tostring(random(1,N/2))})
7 end
9 if arg[1] == "dot" then
10 return digraph{"G", unpack(edges)}
11 else
12 return ugraph{"G", unpack(edges)}
13 end