add_node(self, node_for_adding, **attr)
A hashable object is one that can be used as a key in a Python dictionary. This includes strings, numbers, tuples of strings and numbers, etc.
On many platforms hashable items also include mutables such as NetworkX Graphs, though one should be careful that the hash doesn't change on mutables.
A node can be any hashable Python object except None.
Set or change node attributes using key=value.
Add a single node :None:None:`node_for_adding`
and update node attributes.
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
... G.add_node(1)
... G.add_node("Hello")
... K3 = nx.Graph([(0, 1), (1, 2), (2, 0)])
... G.add_node(K3)
... G.number_of_nodes() 3
Use keywords set/change node attributes:
>>> G.add_node(1, size=10)See :
... G.add_node(3, weight=0.4, UTM=("13S", 382871, 3972649))
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.connectivity.edge_augmentation.weighted_bridge_augmentation
networkx.classes.reportviews.NodeView
networkx.classes.graph.Graph.add_nodes_from
networkx.algorithms.chordal.chordal_graph_cliques
networkx.algorithms.summarization.snap_aggregation
networkx.algorithms.euler.is_eulerian
networkx.algorithms.connectivity.edge_augmentation.unconstrained_bridge_augmentation
networkx.algorithms.operators.product.lexicographic_product
networkx.algorithms.connectivity.edge_augmentation.partial_k_edge_augmentation
networkx.algorithms.connectivity.edge_augmentation.collapse
networkx.classes.graph.Graph
networkx.algorithms.isolate.is_isolate
networkx.algorithms.operators.product.cartesian_product
networkx.algorithms.euler.has_eulerian_path
networkx.algorithms.chordal.chordal_graph_treewidth
networkx.algorithms.operators.product.strong_product
networkx.algorithms.connectivity.edge_augmentation.k_edge_augmentation
networkx.readwrite.gml.generate_gml
networkx.algorithms.chordal._chordal_graph_cliques
networkx.classes.multidigraph.MultiDiGraph
networkx.classes.graph.Graph.add_node
networkx.classes.multigraph.MultiGraph
networkx.algorithms.operators.product.tensor_product
networkx.classes.digraph.DiGraph.add_node
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them