« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Social Network Analysis
Centrality and Prestige of Florentine Families
The Medici family did not have greatest wealth or most seats in the legislature, yet it rose to power. Through marriages, the Medici family had a position of centrality in the social network, crucial for communication, brokering deals, etc.
In[1]:=
X
g = ExampleData[{"NetworkGraph", "FlorentineFamilies"}];
In[2]:=
X
centralities = {BetweennessCentrality, ClosenessCentrality, DegreeCentrality, EccentricityCentrality, EigenvectorCentrality, RadialityCentrality, StatusCentrality, PageRankCentrality[#, .085] &}; values = Through[centralities[g]] ;
In[3]:=
X
highlight[g_, cc_] := Module[{a, b, f}, {b, a} = Part[VertexList[g], Ordering[cc, -2]]; f = {Red, EdgeForm[], Disk[#1, #3], Thick, Circle[#1, 2 #3]} &; SetProperty[g, { VertexSize -> Thread[VertexList[g] -> cc/(3 Max[cc])], VertexShapeFunction -> {a -> f, b -> f}, VertexLabels -> {_ -> None, a -> Placed[a, Above], b -> Placed[b, Above]}}] ];
In[4]:=
X
labels = Flatten[{"Marriage Network", Most[centralities], "PageRankCentrality"}]; data = Transpose[{Prepend[highlight[g, #] & /@ values, g], labels}]; Grid[Partition[ SetProperty[#1, {PlotLabel -> Style[#2, Bold], ImagePadding -> 10}] & @@@ data, 3, 3, 1, {}], Frame -> All]
Out[4]=