NetworkX is a software package in Python for the creation, manipulation, and the study of structure, dynamics, and function of complex networks for Data Science. So, it is useful for studying large complex networks that are represented in the form of graphs with nodes and edges. NetworkX can be used to load and store complex networks. Using this software package, we can generate several types of random and classic networks, build network modules, analyze network structures, draw networks, and design new network algorithms.
Installation:
Creation of nodes:
Adding one node at a time:
Adding a list of nodes:
Now let us create nodes in the graph G. After the addition of nodes 1, 2, 3, 4, 7, 9
Creation of Edges:
Addition of one edge at a time:
Addition of list of edges:
After the addition of edges (1,2), (3,1), (2,4), (4,1), (9,1), (1,7), (2,9)
Removal of nodes and edges:
We can demolish the graph by using the below functions:
After the removal of node 3 we have:
After removal of edge (1,2):
So, tol learn more about networkx in python for data science, you can check this and this as well.
