Module: RGL::GraphIterator

Includes:
GraphWrapper, Stream
Included in:
BFSIterator, TopsortIterator
Defined in:
lib/rgl/graph_iterator.rb

Overview

A GraphIterator is the abstract basis for all Iterators on graphs. Each graph iterator should implement the protocol defined in module Stream.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#graphGraph Originally defined in module GraphWrapper

Returns the wrapped graph.

Returns:

  • (Graph)

    the wrapped graph

Instance Method Details

#initialize(graph) ⇒ Object Originally defined in module GraphWrapper

Creates a new GraphWrapper on graph.

#lengthint

Returns:

  • (int)


16
17
18
# File 'lib/rgl/graph_iterator.rb', line 16

def length
  inject(0) { |sum| sum + 1 }
end