Skip to content

Commit

Permalink
toDot: do not print label if it is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
starius committed Jun 27, 2015
1 parent ebb5a03 commit fba2c6d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/treelua/toDot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ return function(graph)
for n1, n2, edge in graph:iterPairs() do
local n1_s = node2name[n1]
local n2_s = node2name[n2]
local edge_s = edge.length or ''
local edge_str = '%s -- %s [label=%q];'
print(edge_str:format(n1_s, n2_s, edge_s))
if edge.length then
local edge_str = '%s -- %s [label=%q];'
print(edge_str:format(n1_s, n2_s, edge.length))
else
local edge_str = '%s -- %s;'
print(edge_str:format(n1_s, n2_s))
end
end
-- close graph
print('}')
Expand Down

0 comments on commit fba2c6d

Please sign in to comment.