15.08.2015 Views

Introduction to the Modeling and Analysis of Complex Systems

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

17.2. SHORTEST PATH LENGTH 379EccentricityDiameterRadiusε(i) = max d(i → j) (17.16)jThis metric is defined for each node <strong>and</strong> gives <strong>the</strong> maximal shortest path lengtha node can have with any o<strong>the</strong>r node in <strong>the</strong> network. This tells how far <strong>the</strong> nodeis <strong>to</strong> <strong>the</strong> far<strong>the</strong>st point in <strong>the</strong> network.D = maxiε(i) (17.17)This metric gives <strong>the</strong> maximal eccentricity in <strong>the</strong> network. Intuitively, it tells ushow far any two nodes can get from one ano<strong>the</strong>r within <strong>the</strong> network. Nodeswhose eccentricity is D are called peripheries.R = miniε(i) (17.18)This metric gives <strong>the</strong> minimal eccentricity in <strong>the</strong> network. Intuitively, it tells us <strong>the</strong>smallest number <strong>of</strong> steps you will need <strong>to</strong> reach every node if you can choosean optimal node as a starting point. Nodes whose eccentricity is R are calledcenters.In NetworkX, <strong>the</strong>se metrics can be calculated as follows:Code 17.8:>>> import networkx as nx>>> g = nx.karate_club_graph()>>> nx.average_shortest_path_length(g)2.408199643493761>>> nx.eccentricity(g){0: 3, 1: 3, 2: 3, 3: 3, 4: 4, 5: 4, 6: 4, 7: 4, 8: 3, 9: 4, 10: 4,11: 4, 12: 4, 13: 3, 14: 5, 15: 5, 16: 5, 17: 4, 18: 5, 19: 3, 20: 5,21: 4, 22: 5, 23: 5, 24: 4, 25: 4, 26: 5, 27: 4, 28: 4, 29: 5, 30: 4,31: 3, 32: 4, 33: 4}>>> nx.diameter(g)5>>> nx.periphery(g)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!