Class: HG::Hypergraph
- Inherits:
-
Object
- Object
- HG::Hypergraph
- Defined in:
- lib/zipf/hg.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.
29 30 31 32 |
# File 'lib/zipf/hg.rb', line 29 def initialize nodes=[], edges=[] @nodes = nodes @edges = edges end |
Instance Attribute Details
#edges ⇒ Object
Returns the value of attribute edges.
27 28 29 |
# File 'lib/zipf/hg.rb', line 27 def edges @edges end |
#nodes ⇒ Object
Returns the value of attribute nodes.
27 28 29 |
# File 'lib/zipf/hg.rb', line 27 def nodes @nodes end |
Instance Method Details
#arity ⇒ Object
34 35 36 |
# File 'lib/zipf/hg.rb', line 34 def arity @edges.map { |e| e.arity }.max end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/zipf/hg.rb', line 38 def to_s "Hypergraph<nodes:[#{@nodes.to_s}], edges:[#{@edges.to_s}], arity:#{arity}>" end |