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
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
Returns the value of @directed.
# File lib/rgl/implicit.rb, line 48 def directed? @directed end
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
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
Generated with the Darkfish Rdoc Generator 2.