diff options
author | koray kavukcuoglu <koray@kavukcuoglu.org> | 2013-04-01 03:10:21 +0400 |
---|---|---|
committer | koray kavukcuoglu <koray@kavukcuoglu.org> | 2013-04-01 03:10:21 +0400 |
commit | a39b93620b3e6ee24877ba16021a9b1a5aaff687 (patch) | |
tree | 83ee59a84966ea92f99a8c3b28fca9aed05f6842 | |
parent | 05ab07d164a2a78fe27f67689a7f55f510f09bb7 (diff) |
make sure that roots() returns nodes in children insert order which is also consistent with bfs tarversal order.
-rw-r--r-- | init.lua | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -133,7 +133,7 @@ function Graph:roots() for root,i in pairs(rootnodes) do table.insert(roots, root) end - table.sort(roots,function(a,b) return rootnodes[a] < rootnodes[b] end ) + table.sort(roots,function(a,b) return self.nodes[a] < self.nodes[b] end ) return roots end @@ -142,11 +142,10 @@ function Graph:todot() local edges = self.edges str = {} table.insert(str,'digraph G {\n') - table.insert(str,'node [shape = circle]; ') + table.insert(str,'node [shape = oval]; ') local nodelabels = {} for i,node in ipairs(nodes) do local l = '"' .. (node:label() or 'n' .. i) .. '"' - l = l:gsub('\n','') nodelabels[node] = 'n' .. i table.insert(str, '\n' .. nodelabels[node] .. '[label=' .. l .. '];') end |