Sha256: 55798cd777be804e2a06a5536da4a99379358cf29bd76486015f65098cd1e160

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 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

1 entries across 1 versions & 1 rubygems

Version Path
dogviz-0.0.22 tests/graph_checking.rb