Sha256: 624dc0091d7d9de4b34133b3bfb23bb0fcd6c1fe6a872c46e1b69d6eacbc08b8

Contents?: true

Size: 589 Bytes

Versions: 3

Compression:

Stored size: 589 Bytes

Contents

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

  def subgraph_ids_without_cluster_prefixes
    subgraph_ids.map {|id| id.gsub /^cluster_/, '' }
  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

3 entries across 3 versions & 1 rubygems

Version Path
dogviz-0.0.21 tests/graph_checking.rb
dogviz-0.0.20 tests/graph_checking.rb
dogviz-0.0.19 tests/graph_checking.rb