Network topology and community detection
Understanding the topology of the network as well as the role of its nodes is a crucial step in the analysis of a social network. It is important to keep in mind that, in this context, nodes are actually users, each with their own interests, habits, and behaviors. Such knowledge will be extremely useful when performing predictions and/or finding insights.
We will be using networkx
to compute most of the useful metrics we have seen in Chapter 1, Getting Started with Graphs. We will try to give them an interpretation to collect insight into the graph. Let's begin as usual, by importing the required libraries and defining some variables that we will use throughout the code:
import os import math import numpy as np import networkx as nx import matplotlib.pyplot as plt default_edge_color = 'gray' default_node_color = '#407cc9' enhanced_node_color = '#f5b042' enhanced_edge_color = '#cc2f04'
We...