Learn practical skills, build real-world projects, and advance your career
Python version: >=3.7
Networkx version: >=2.3
Last update: 25/11/2021

Chapter 4: Centrality & Assortative Mixing

In this notebook are introduced basilar analysis to cover node centrality and assortative mixing.

Note: this notebook is purposely not 100% comprehensive, it only discusses the basic things you need to get started.

import networkx as nx
import warnings
import numpy as np
import random
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
warnings.filterwarnings('ignore')
from google.colab import drive
drive.mount('/content/drive')
%matplotlib inline 
def read_net(filename):
    g = nx.Graph()
    with open(filename) as f:
        f.readline()
        for l in f:
            l = l.split(",")
            g.add_edge(l[0], l[1])
    return g

# Game of Thrones data
season = 6
g = read_net(f'/content/drive/MyDrive/LeADS/course_network_science/data/asioaf/got-s{season}-edges.csv')