New in Wolfram
Mathematica
8: Graph & Network Analysis
◄
previous
|
next
►
Application Areas
Degree Centrality in Social Networks
Find people with more influence in a social network.
In[1]:=
X
people = {"Elisabeth", "James", "Anna", "John", "Dorothy", "Linda", "Michael", "Larry", "Carol", "Nancy", "David", "Nora", "Julia", "Ben", "Oscar", "Felicia", "Arlene", "Rudy"};
In[2]:=
X
relations = Join @@ Table[ UndirectedEdge @@@ Subsets[family, {2}], {family, {{"Elisabeth", "Anna"}, {"James", "Anna", "Linda", "Larry", "Nancy"}, {"John", "Dorothy", "David"}, {"Linda", "Michael", "Nora", "Julia"}, {"Larry", "Carol", "Ben", "Oscar"}, {"Nancy", "David", "Arlene"}, {"Oscar", "Felicia"}, {"Arlene", "Rudy"}}}];
In[3]:=
X
g = Graph[people, relations, VertexSize -> Large, VertexLabels -> "Name", ImagePadding -> 30];
In[4]:=
X
cc = DegreeCentrality[g];
In[5]:=
X
HighlightGraph[g, Table[Style[VertexList[g][[i]], ColorData["SolarColors"][cc[[i]]/Max[cc]]], {i, VertexCount[g]}], ImageSize -> 500]
Out[5]=