Method: Graph#idistance
- Defined in:
- lib/rgraph/graph.rb
#idistance ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rgraph/graph.rb', line 60 def idistance dist = matrix(@nodes.size, 0) @nodes.values.each_with_index do |n1, i| @nodes.values.each_with_index do |n2, j| next if i == j dist[i][j] = n1.has_neighbour?(n2) ? link_between(n1, n2)[:weight].to_i : @infinity end end dist end |