Class: RGL::EdgePropertiesMap

Inherits:
Object
  • Object
show all
Defined in:
lib/rgl/edge_properties_map.rb

Direct Known Subclasses

NonNegativeEdgePropertiesMap

Instance Method Summary collapse

Constructor Details

#initialize(edge_properties_map, directed) ⇒ EdgePropertiesMap

Returns a new instance of EdgePropertiesMap.



5
6
7
8
9
10
# File 'lib/rgl/edge_properties_map.rb', line 5

def initialize(edge_properties_map, directed)
  @edge_properties_map = edge_properties_map
  @directed = directed

  check_properties
end

Instance Method Details

#edge_property(u, v) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rgl/edge_properties_map.rb', line 12

def edge_property(u, v)
  if @directed
    property = @edge_properties_map[[u, v]]
  else
    property = @edge_properties_map[[u, v]] || @edge_properties_map[[v, u]]
  end

  validate_property(property, u, v)

  property
end