Qurak

Degree centrality in social networks

Example 3 steps, run in order in one session. Every step was executed against the engine and the output below is what it produced.

Step 1
g = ExampleData[{"NetworkGraph", "FamilyGathering"}];

No output - this step sets something up for the next one.

Step 2
Part[VertexList[g], Ordering[EigenvectorCentrality[g], All, Greater]]
Output
VertexList[ExampleData[{NetworkGraph, FamilyGathering}]]
Step 3
cc = DegreeCentrality[g];
HighlightGraph[g, Table[Style[VertexList[g][[i]], ColorData["TemperatureMap"][cc[[i]] / Max[cc]]], {i, VertexCount[g]}], ImageSize -> 300]
Output
HighlightGraph[ExampleData[{NetworkGraph, FamilyGathering}], Table[VertexList[g][[i]], {i, VertexCount[g]}], ImageSize -> 300]

Functions used

Related recipes

All recipes · Function reference · Use this from an MCP client