class RGL::ImplicitGraph

Constants

EMPTY_NEIGHBOR_ITERATOR
EMPTY_VERTEX_ITERATOR

Attributes

directed[W]

Public Class Methods

new() { |self| ... } click to toggle source

Create a new ImplicitGraph, which is empty by default. The caller should configure the graph using vertex and neighbor iterators. If the graph is directed, the client should set directed to true. The default value for directed is false.

   # File lib/rgl/implicit.rb
39 def initialize
40   @directed          = false
41   @vertex_iterator   = EMPTY_VERTEX_ITERATOR
42   @adjacent_iterator = EMPTY_NEIGHBOR_ITERATOR
43   yield self if block_given? # Let client overwrite defaults.
44 end

Public Instance Methods

adjacent_iterator(&block) click to toggle source

Sets the adjacent_iterator to block, which must be a block of two parameters:

The first parameter is the vertex the neighbors of which are to be
traversed.

The second is the block which will be called for each neighbor
of this vertex.
   # File lib/rgl/implicit.rb
85 def adjacent_iterator(&block)
86   @adjacent_iterator = block
87 end
directed?() click to toggle source

Returns the value of @directed.

   # File lib/rgl/implicit.rb
48 def directed?
49   @directed
50 end
edge_iterator(&block) click to toggle source

Sets the edge_iterator to block, which must be a block of two parameters: The first parameter is the source of the edges; the second is the target of the edge.

   # File lib/rgl/implicit.rb
93 def edge_iterator(&block)
94   @edge_iterator = block
95 end
vertex_iterator(&block) click to toggle source

Sets the vertex_iterator to block, which must be a block of one parameter which again is the block called by each_vertex.

   # File lib/rgl/implicit.rb
72 def vertex_iterator(&block)
73   @vertex_iterator = block
74 end