lib/networkx/graph.rb
# Adds multiple edges from an array
#
# @example Add multiple edges without any attributes
#   graph.add_edges([['Nagpur', 'Kgp'], ['Noida', 'Kgp']])
# @param edges [Array<Object, Object>]
Adds multiple edges from an array
Adds multiple edges from an array
def add_edges(edges)
      case edges
      when Array
        edges.each { |node_1, node_2, **attrs| add_edge(node_1, node_2, attrs) }
      else
        raise ArgumentError, 'Expected argument to be an Array of edges, '\
                             "received #{edges.class.name} instead."
      end
    end
def add_edges ( edges ) case edges when Array edges . each { | node_1 , node_2 , ** attrs | add_edge ( node_1 , node_2 , attrs ) } else raise ArgumentError , 'Expected argument to be an Array of edges, ' "received #{edges.class.name} instead." end end
Adds multiple edges from an array
Adds multiple edges from an array
edges
<not_specific>
<not_specific>
None
example
Add multiple edges without any attributes graph.add_edges([['Nagpur', 'Kgp'], ['Noida', 'Kgp']])
Add multiple edges without any attributes graph . add_edges ( [[ ' Nagpur ' ' Kgp ' ] [ ' Noida ' ' Kgp ' ]] )