Class: HG::Hypergraph
- Inherits:
-
Object
- Object
- HG::Hypergraph
- Defined in:
- lib/zipf/hypergraph.rb
Instance Attribute Summary collapse
-
#edges ⇒ Object
Returns the value of attribute edges.
-
#nodes ⇒ Object
Returns the value of attribute nodes.
Instance Method Summary collapse
- #arity ⇒ Object
-
#initialize(nodes = [], edges = []) ⇒ Hypergraph
constructor
A new instance of Hypergraph.
- #to_s ⇒ Object
Constructor Details
#initialize(nodes = [], edges = []) ⇒ Hypergraph
Returns a new instance of Hypergraph.
27 28 29 30 |
# File 'lib/zipf/hypergraph.rb', line 27 def initialize nodes=[], edges=[] @nodes = nodes @edges = edges end |
Instance Attribute Details
#edges ⇒ Object
Returns the value of attribute edges.
25 26 27 |
# File 'lib/zipf/hypergraph.rb', line 25 def edges @edges end |
#nodes ⇒ Object
Returns the value of attribute nodes.
25 26 27 |
# File 'lib/zipf/hypergraph.rb', line 25 def nodes @nodes end |
Instance Method Details
#arity ⇒ Object
32 33 34 |
# File 'lib/zipf/hypergraph.rb', line 32 def arity @edges.map { |e| e.arity }.max end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/zipf/hypergraph.rb', line 36 def to_s "Hypergraph<nodes:[#{@nodes.to_s}], edges:[#{@edges.to_s}], arity:#{arity}>" end |