Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
2  
Clustering coefficient. Eccentricity? Vertex centrality? (Or see See Also section) Closeness. Betweenness. –  Öskå May 10 at 17:00

1 Answer 1

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 at 18:50
    
@m_goldberg, Office 2010 default font family:) –  kguler May 10 at 18:58
    
Your answer and @Oska's comment were very helpful. Your efforts are appreciated. –  bhkj May 11 at 15:50
    
@bhkj I only Googled what you typed. See here and here. –  Öskå May 11 at 16:02
    
@bhkj, glad it was useful for you. Thanks for the accept. –  kguler May 11 at 16:22

Your Answer

 
discard

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.