Sha256: 76e50cf66d2d1dfc0cc56b3470659b2605fb5c4e61a3895eaf60ead8f752cc04

Contents?: true

Size: 485 Bytes

Versions: 5

Compression:

Stored size: 485 Bytes

Contents

module GraphChecking
  def subgraph_ids
    subgraphs.map(&:id)
  end

  def subgraph(id)
    subgraphs.find {|sub| sub.id == id }
  end

  def subgraphs(from=graph)
    subs = []
    from.each_graph {|sub_name, sub|
      subs << sub
      subs += subgraphs(sub)
    }
    subs
  end

  def connections(sep=' ')
    edges.map {|e|
      "#{e.tail_node}->#{e.head_node}"
    }.join sep
  end

  def edges
    graph.each_edge
  end

  def find(name)
    graph.find_node name
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dogviz-0.0.18 tests/graph_checking.rb
dogviz-0.0.17 tests/graph_checking.rb
dogviz-0.0.16 tests/graph_checking.rb
dogviz-0.0.15 tests/graph_checking.rb
dogviz-0.0.14 tests/graph_checking.rb