class RGL::ImplicitGraph

An ImplicitGraph provides a handy way to define graphs on the fly, using two blocks for the two iterators defining a graph. Other examples are given by the methods {#vertices_filtered_by} and {#edges_filtered_by}, which can be applied to any graph.

@example

# A directed cyclic graph, with five vertices can be created as follows:
g = RGL::ImplicitGraph.new do |g|
  g.vertex_iterator { |b| 0.upto(4,&b) }
  g.adjacent_iterator { |x, b| b.call((x+1)%5) }
  g.directed = true
end

g.to_s # => "(0-1)(1-2)(2-3)(3-4)(4-0)"