Class: Mementus::GraphBuilder

Inherits:
Object
  • Object
show all
Includes:
Mutators
Defined in:
lib/mementus/graph_builder.rb

Instance Method Summary collapse

Methods included from Mutators

#add_edge, #add_node, #create_edge, #create_node, #remove_edge, #remove_node, #set_edge, #set_node

Constructor Details

#initialize(is_directed) ⇒ GraphBuilder

Returns a new instance of GraphBuilder.



5
6
7
8
9
# File 'lib/mementus/graph_builder.rb', line 5

def initialize(is_directed)
  @structure = Structure::IncidenceList.new(is_directed)
  @node_ids = IntegerId.new
  @edge_ids = IntegerId.new
end

Instance Method Details

#graphObject



19
20
21
# File 'lib/mementus/graph_builder.rb', line 19

def graph
  @structure
end

#next_edge_idObject



15
16
17
# File 'lib/mementus/graph_builder.rb', line 15

def next_edge_id
  @edge_ids.next_id
end

#next_node_idObject



11
12
13
# File 'lib/mementus/graph_builder.rb', line 11

def next_node_id
  @node_ids.next_id
end