A beginner’s tutorial on Social Network Analysis – (Part 1)

Social Network Analysis refers to the methods used for analyzing social networks or interconnections among individuals. The individuals are taken as “nodes” and are connected to each other based on their interconnections, which may be of various types (friendship, co-authorship, kinship, sexual relations, financial exchange, common interest etc.) SNA uses various techniques from Graph Theory, Game Theory and several other to study, explain and predict the network.

Getting the tools:

NetworkX is a Python-based package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks. If you are on a linux distribution like Ubuntu chances are it will be in your package manager. Otherwise, you can download and install the binary or even compile it from source from here.

Head-first to NetworkX:


Next we need to create a graph,

Let”s say we have 4 nodes named ”a”,”b”,”c” and ”d” and edges between (a,b) , (b,c) and (a,d).to add a node we can just use:

We can also add all nodes from an iterable to the graph.

Nodes can also have attributes: attribute can be from a dictionary

You can have any number of attributes according to your choice.Next we will add some edges. Adding
an edge is exactly similar to adding a node.

Next we will analyze this graph.

NetworkX provides many other methods to access different properties of the network and analyze them.(In the next parts, we will discuss on how to get a visual representation of the network, collecting data for our network, and work with a real life network) In case of any issues or suggestions please add a comment to this post.

Leave a Reply