Emergence of connectedness in Social Networks
Prerequisite: Basics of NetworkX
The emergence of connectedness is to check whether the graph is connected or not. It says that in a graph of N nodes, we just need NLogN edges to make graph connected.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
The following algorithm to be followed:
- Take any random graph with N number of nodes.
- Now choose any node as a starting node.
- Now add random edges to the graph and check every time if the graph is connected or not.
- If the graph is not connected then repeat steps 2 and 3.
- If the graph is connected then check the number of edges that are added and this will be equal to NLogN.
- Now check both the plots will be almost similar.
Code for Checking connectedness:
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200