lib/networkx/digraph.rb
def add_node(node, **node_attrs)
      super(node, node_attrs)

      @pred[node] = {} unless @pred.key?(node)
    end
# Adds a node and its attributes to the graph
#
# @example Add a node with attribute 'type'
#   graph.add_node("Noida", type: "city")
#
# @param node [Object] the node object
# @param node_attrs [Hash{ Object => Object }] the hash of the attributes of the node
Adds a node and its attributes to the graph
Adds a node and its attributes to the graph
def add_node(node, **node_attrs)
      super(node, node_attrs)
      @pred[node] = {} unless @pred.key?(node)
    end
def add_node ( node , ** node_attrs ) super ( node , node_attrs ) @pred [ node ] = { } unless @pred . key? ( node ) end
Adds a node and its attributes to the graph
Adds a node and its attributes to the graph
node
the node object
the node object
node_attrs
the hash of the attributes of the node
the hash of the attributes of the node
example
Add a node with attribute 'type' graph.add_node("Noida", type: "city")
Add a node with attribute ' type ' graph . add_node ( " Noida " type : " city " )