Method: NetworkX::Graph#nodes

Defined in:
lib/networkx/graph.rb

#nodes(data: false) ⇒ Hash | Array

Return nodes of graph

Parameters:

  • data (bool) (defaults to: false)

    true if you want data of each edge

Returns:

  • (Hash | Array)

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



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

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