Class: AbstractGraph::Composition::Edge
- Inherits:
-
Object
- Object
- AbstractGraph::Composition::Edge
- Defined in:
- lib/abstract_graph/composition/edge.rb,
lib/abstract_graph/composition/edge/initialize.rb,
lib/abstract_graph/composition/edge/is_coincident.rb
Overview
public Edge class
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#vertices ⇒ Object
Returns the value of attribute vertices.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Edge
constructor
A new instance of Edge.
-
#is_coincident?(e) ⇒ Boolean
returns whether or not e covers the same two vertices p: Edge e is the comparing edge.
Constructor Details
#initialize(*args) ⇒ Edge
Returns a new instance of Edge.
7 8 9 10 11 12 13 14 |
# File 'lib/abstract_graph/composition/edge/initialize.rb', line 7 def initialize ( *args ) if args[0].class == String @name = args[0] else @name = "" end @vertices = args[-2, 2] end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/abstract_graph/composition/edge.rb', line 8 def name @name end |
#vertices ⇒ Object
Returns the value of attribute vertices.
9 10 11 |
# File 'lib/abstract_graph/composition/edge.rb', line 9 def vertices @vertices end |
Instance Method Details
#is_coincident?(e) ⇒ Boolean
returns whether or not e covers the same two vertices p: Edge e is the comparing edge
9 10 11 |
# File 'lib/abstract_graph/composition/edge/is_coincident.rb', line 9 def is_coincident? e return ( ( e.vertices | @vertices ) - ( e.vertices & @vertices ) ).empty? end |