Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a graph WS = RandomGraph[WattsStrogatzGraphDistribution[n, p, k]]. I need to plot several characteristics of each v: the clustering coefficient, number of triples at v, eccentricity, vertex centrality, closeness, and betweenness. I'm relatively inexperienced with Mathematica and quite lost on how to achieve this. I don't expect the exact lines of the solution, I'd just like some pointers on how to approach this. First of all, how do I get a set of all the vertices of WS? Then, how do I get the values of the different measures for each v in WS?

share|improve this question
Clustering coefficient. Eccentricity? Vertex centrality? (Or see See Also section) Closeness. Betweenness. – Öskå May 10 '14 at 17:00
up vote 3 down vote accepted

Using the built-in functions mentioned in @Oska's comment:

ws = RandomGraph[WattsStrogatzGraphDistribution[6, 0.1, 2]]; 
centralities = {LocalClusteringCoefficient,  EccentricityCentrality, 
    VertexDegree, ClosenessCentrality, BetweennessCentrality}; 
Through[centralities[ws]] // Style[TableForm[Round[#, .001], 
      TableHeadings -> {centralities, VertexList[ws]}], FontFamily -> "Calibri", 24] &

enter image description here

share|improve this answer
Interesting choice of font. – m_goldberg May 10 '14 at 18:50
@m_goldberg, Office 2010 default font family:) – kglr May 10 '14 at 18:58
Your answer and @Oska's comment were very helpful. Your efforts are appreciated. – bhkj May 11 '14 at 15:50
@bhkj I only Googled what you typed. See here and here. – Öskå May 11 '14 at 16:02
@bhkj, glad it was useful for you. Thanks for the accept. – kglr May 11 '14 at 16:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.