Social Network Analysis
Social Network Graph
For demonstrating the power of network x, I use small network x built-in graph called Les miserable s graph that returns co appearance network of characters in the novel Les Miserable s.
Basic information
As you can see below:
This graph has 77 nodes with 254 edges
It's an redirection graph
all nodes are connected
Graph with 77 nodes and 254 edges
undirected
connected
Visualization
First I use simple network x draw method to visualize the graph with spring layout as below
Then for better interactive visualization i use pyviz package:
Exploratory Analysis
Average Degree
The average degree is 6.597402597402597
Degree Distribution
Plot the degree distribution to get a better insight
Centrality
Degree Centrality
Napoleon
0
0.3015873016
Myriel
0.1768421053
0.4293785311
MlleBaptistine
0
0.4130434783
MmeMagloire
0
0.4130434783
CountessDeLo
0
0.3015873016
Geborand
0
0.3015873016
Champtercier
0
0.3015873016
Cravatte
0
0.3015873016
Count
0
0.3015873016
OldMan
0
0.3015873016
we have 18 bridges in the graph
The edge density is 0.08680792891319207
Triadic closure: 0.49893162393162394
we found 5 communities
community_1 is:
Valjean, Marguerite, Champmathieu, Fauchelevent, Myriel, Isabeau, Cravatte, Cochepaille, CountessDeLo, Labarre, Judge, Chenildieu, MmeDeR, MotherInnocent, Count, MlleBaptistine, MmeMagloire, Gervais, Brevet, OldMan, Geborand, Woman1, Napoleon, Champtercier, Scaufflaire, Gribier
community_2 is:
Child2, Courfeyrac, Combeferre, Gavroche, Bossuet, Prouvaire, Jondrette, Joly, Child1, Feuilly, MmeBurgon, MotherPlutarch, Grantaire, Mabeuf, Enjolras, Bahorel, MmeHucheloup
community_3 is:
Javert, Anzelma, Boulatruelle, Perpetue, Fantine, Babet, Eponine, Bamatabois, Montparnasse, Brujon, MmeThenardier, Thenardier, Simplice, Gueulemer, Claquesous
community_4 is:
Marius, BaronessT, Cosette, MlleGillenormand, LtGillenormand, Woman2, MlleVaubois, Pontmercy, MmePontmercy, Toussaint, Gillenormand, Tholomyes, Magnon
community_5 is:
Favourite, Dahlia, Fameuil, Blacheville, Listolier, Zephine
The modularity of this communities is: 0.4729424449732302
The coverage of this communities is: 0.7322834645669292
and the perfomance is: 0.815105946684894
we found 5 communities
community_1 is:
Marius, Courfeyrac, Combeferre, Valjean, Bossuet, Gavroche, Prouvaire, Joly, Feuilly, Grantaire, Enjolras, Mabeuf, Bahorel, MmeHucheloup
community_2 is:
Judge, Chenildieu, Valjean, Brevet, Champmathieu, Bamatabois, Cochepaille
community_3 is:
Valjean, Gavroche, Gueulemer, Javert, Cosette, Fantine, Babet, Eponine, Montparnasse, Brujon, Thenardier, MmeThenardier, Claquesous
community_4 is:
Marius, Cosette, Valjean, LtGillenormand, MlleGillenormand, Gillenormand
community_5 is:
Favourite, Blacheville, Fantine, Listolier, Dahlia, Fameuil, Tholomyes, Zephine
we found 6 communities
community_1 is:
BaronessT, Cosette, MlleGillenormand, LtGillenormand, Woman2, MlleVaubois, Pontmercy, MmePontmercy, Toussaint, Gillenormand, Magnon
community_2 is:
Marius, Courfeyrac, Combeferre, Feuilly, Gavroche, Bossuet, Prouvaire, Grantaire, Mabeuf, Enjolras, MmeHucheloup, Bahorel, Joly
community_3 is:
MlleBaptistine, MmeMagloire, OldMan, Geborand, Cravatte, Napoleon, CountessDeLo, Champtercier, Myriel, Count
community_4 is:
Boulatruelle, Blacheville, Dahlia, Javert, Thenardier, Zephine, Favourite, Perpetue, Gueulemer, Anzelma, Fantine, Babet, Eponine, Listolier, Montparnasse, Brujon, MmeThenardier, Simplice, Fameuil, Tholomyes, Claquesous
community_5 is:
MotherInnocent, Valjean, Marguerite, Gervais, Brevet, Champmathieu, Fauchelevent, Woman1, Bamatabois, Isabeau, Cochepaille, Labarre, Judge, Chenildieu, MmeDeR, Scaufflaire, Gribier
community_6 is:
Child2, Child1, MotherPlutarch, MmeBurgon, Jondrette
The coverage of this communities is: 0.7755905511811023
and the perfomance is: 0.8653451811346549