Parent

Included Modules

Files

RGL::ImplicitGraph

Attributes

directed[W]

Public Class Methods

new() 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, line 39
def initialize
  @directed = false
  @vertex_iterator   = EMPTY_VERTEX_ITERATOR
  @adjacent_iterator = EMPTY_NEIGHBOR_ITERATOR
  yield self if block_given?  # Let client overwrite defaults.
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, line 85
def adjacent_iterator (&block)
  @adjacent_iterator = block
end
directed?() click to toggle source

Returns the value of @directed.

# File lib/rgl/implicit.rb, line 48
def directed?
  @directed
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, line 93
def edge_iterator (&block)
  @edge_iterator = block
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, line 72
def vertex_iterator (&block)
  @vertex_iterator = block
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.