solving graph problems using networkx
TRANSCRIPT
Solving Graph problems using Network X
So What’s our Agenda ?
1. Getting to know Graphs2. Looking at some cool Graphs3. Playing around with Network X
The Wonderful Story of Graphs(TL;DR version)
In the beginning someone said … Let there be nodes.
Nodes remained in isolation for a long time until a mysterious force said.
Let there be edges.
- Nodes became Happy at being connected to other Nodes through edges.
- They wanted to give a name to this Union of nodes and edges, some mysterious person suggested ‘Graph’ is a cool name.
So the Nodes and Edges lived happily ever after
THE END
Need More Info?
Wikipedia says “A graph is an ordered pair G = (V, E) comprising a set V of vertices or nodes together with a set E of edges. “
V = {1, 2, 3, 4, 5, 6}E = {{1, 2}, {1, 5}, {2, 3}, {2, 5}, {3, 4}, {4, 5}, {4, 6}}
Some Interesting Graphs
Where else can we see applications of Graphs ?
& More
NetworkX : A friendly Python library
How to Create miserable lonely Nodes ?
That’s how you add Edges!
You Can Multitask , Multi add edges
Just some housekeeping
Generating Graphs are Super Easy !!
Now good luck trying to draw that with hand
This is my favourite . So don’t ask me anything about it
We can add more details to Node and Edges.
Reading Graphs in other Formats
Matplotlib is not the right tool always
Alternatives for Better Visualization
Let’s try something ambitious now.
A) Read 1 Crore lines of edge information from a datasetB) And find the node with the highest degree.C) Calculate how much time it took for loading the graph