WNA in action
As mentioned in the previous chapter, in NetworkX, you are able to construct networks as either undirected, directed, multi-, or multi-directed graphs. In this chapter, we’re going to use an undirected graph, as I want to show how certain functionality can be used to understand networks. Just know this: what I am about to show has different implications if you use one of the other types of networks. You also have more options to explore when you use directed networks, such as investigating in_degrees
and out_degrees
, not just degrees in general.
Loading data and creating networks
The first thing we need to do is construct our graph. We cannot analyze what we do not have:
- You can read the K-pop edge list from my GitHub like so:
import pandas as pd
data = 'https://raw.githubusercontent.com/itsgorain/datasets/main/networks/kpop/kpop_edgelist.csv'
df = pd.read_csv(data)
df['source'] = df['source'].str[0:16]
df['target&apos...