Method: Bio::Pathway#initialize

Defined in:
lib/bio/pathway.rb

#initialize(relations, undirected = false) ⇒ Pathway

Initial graph (adjacency list) generation from the list of Relation.

Generate Bio::Pathway object from the list of Bio::Relation objects. If the second argument is true, undirected graph is generated.

r1 = Bio::Relation.new('a', 'b', 1)
r2 = Bio::Relation.new('a', 'c', 5)
r3 = Bio::Relation.new('b', 'c', 3)
list = [ r1, r2, r3 ]
g = Bio::Pathway.new(list, 'undirected')


41
42
43
44
45
46
47
48
# File 'lib/bio/pathway.rb', line 41

def initialize(relations, undirected = false)
  @undirected = undirected
  @relations = relations
  @graph = {}   # adjacency list expression of the graph
  @index = {}   # numbering each node in matrix
  @label = {}   # additional information on each node
  self.to_list    # generate adjacency list
end