2

I have two csv files. names.csv is containing name of person and its corresponding node and nodelinks.csv file is containing the link weight between nodes(persons). nodelinks.csv contains information about how many times a person calls other person(how many times is represented as weight column).

I want to create a network which is divided into sub-networks according to leaders, followers, marginals, outliers and bridges in the network.

enter image description here

enter image description here

I searched internet and I found out networkx library in python. So I tried networkx and it gave me an output of the whole network but it is very clustered i.e. nodes are drawn on top of each other in the output. I'd like to get an output of the network that can be easily understood and also i want to find out sub-networks, leaders, followers, marginals, outliers and bridges in that network.

What I've tried so far

import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
df = pd.read_csv('Nodelinks.csv')
df.columns = ['Source', 'Destination', 'Link']
df.head()
graph = nx.from_pandas_edgelist(df, source = 'Source', target = 
'Destination', edge_attr = 'Link',create_using = nx.DiGraph())
plt.figure(figsize = (10,9))
nx.draw(graph, node_size=1200, node_color='lightblue',
linewidths=0.25, font_size=10, font_weight='bold', with_labels=True, 
dpi=1000)
plt.show()

Install networkx library using pip or conda. I tried using pip but it was showing me error. I tried to install it using conda and it worked.

The dataset and jupyter notebook is uploaded on mega.

I don't know how I should proceed next to get what I want as the output. Also, is there any other way to go about this topic?(preferably easier way if there is one)

Community
  • 1
  • 1
klaptor
  • 115
  • 10

0 Answers0