Method: NetworkX::Graph#nodes

Defined in:
lib/networkx/graph.rb

#nodes(data: true) ⇒ Hash | Array

[TODO] Current default of data is true. [Alert] Change the default in the futher. Please specify the data.

Parameters:

  • data (bool) (defaults to: true)

    true if you want data of each edge

Returns:

  • (Hash | Array)

    if data is true, it returns hash including data. otherwise, simple nodes array.



223
224
225
226
227
228
229
# File 'lib/networkx/graph.rb', line 223

def nodes(data: true)
  if data
    @nodes
  else
    @nodes.keys
  end
end