Module: BK::DotGraphable

Included in:
Node
Defined in:
lib/bk/dot_graph.rb

Instance Method Summary collapse

Instance Method Details

#graphObject



5
6
7
8
9
10
11
# File 'lib/bk/dot_graph.rb', line 5

def graph
  %{"#{term}" [label = "#{term}"]\n} +
  children.sort_by{ |distance, child| distance }.map{ |distance, child|
    child.graph +
    %{edge [label = "#{distance}"]\n"#{term}" -> "#{child.term}"\n}
  }.join
end