degree centrality
play

Degree centrality Network Analysis in Python I Important nodes - PowerPoint PPT Presentation

NETWORK ANALYSIS IN PYTHON I Degree centrality Network Analysis in Python I Important nodes Which nodes are important? Degree centrality Betweenness centrality Network Analysis in Python I Important nodes Which centre


  1. NETWORK ANALYSIS IN PYTHON I Degree centrality

  2. Network Analysis in Python I Important nodes ● Which nodes are important? ● Degree centrality ● Betweenness centrality

  3. Network Analysis in Python I Important nodes ● Which centre node might be more important?

  4. Network Analysis in Python I Important nodes ● Which centre node might be more important?

  5. Network Analysis in Python I Degree centrality ● Definition: Number of Neighbours I Have Number of Neighbours I Could Possibly Have ● Examples of nodes with high degree centrality: ● Twi � er broadcasters ● Airport transportation hubs ● Disease super-spreaders

  6. Network Analysis in Python I Number of neighbors In [1]: G.edges() Out[1]: [(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9)] In [2]: G.neighbors(1) Out[2]: [2, 3, 4, 5, 6, 7, 8, 9] In [3]: G.neighbors(8) Out[3]: [1] In [4]: G.neighbors(10) …… NetworkXError: The node 10 is not in the graph.

  7. Network Analysis in Python I Degree centrality In [5]: nx.degree_centrality(G) Out[5]: {1: 1.0, 2: 0.125, 3: 0.125, 4: 0.125, 5: 0.125, 6: 0.125, 7: 0.125, 8: 0.125, 9: 0.125}

  8. NETWORK ANALYSIS IN PYTHON I Let’s practice!

  9. NETWORK ANALYSIS IN PYTHON I Graph algorithms

  10. Network Analysis in Python I Finding paths ● Pathfinding is important for ● Optimization: e.g. shortest transport paths ● Modeling: e.g. disease spread, information passing ● Algorithm: Breadth-first search

  11. Network Analysis in Python I Breadth-first search (BFS) ● Example: Shortest path between two nodes

  12. Network Analysis in Python I Breadth-first search (BFS) ● Example: Shortest path between two nodes

  13. Network Analysis in Python I Breadth-first search (BFS) ● Example: Shortest path between two nodes

  14. Network Analysis in Python I Breadth-first search (BFS) ● Example: Shortest path between two nodes

  15. Network Analysis in Python I Recall: Neighbors In [1]: G Out[1]: <networkx.classes.graph.Graph at 0x10cc08828> In [2]: len(G.edges()) Out[2]: 57 In [3]: len(G.nodes()) Out[3]: 20 In [4]: G.neighbors(1) Out[4]: [10, 5, 14, 7] In [5]: G.neighbors(10) Out[5]: [1, 19, 5, 17, 8, 9, 13, 14]

  16. NETWORK ANALYSIS IN PYTHON I Let’s practice!

  17. NETWORK ANALYSIS IN PYTHON I Betweenness centrality

  18. Network Analysis in Python I All shortest paths ● Set of paths ● Each path is shortest path between a given pair of nodes ● Done for all node pairs

  19. Network Analysis in Python I Betweenness centrality ● Definition: num. shortest paths through node all possible shortest paths ● Application: ● Bridges between liberal- and conservative- leaning Twi � er users ● Critical information transfer links

  20. Network Analysis in Python I Examples ● Singapore: Ra ffl es Place & Jurong East Source: h � p://www.seacitymaps.com/singapore/singapore_mrt_map.jpg

  21. Network Analysis in Python I Example ● High betweenness centrality, low degree centrality?

  22. Network Analysis in Python I Betweenness centrality In [5]: import networkx as nx In [6]: G = nx.barbell_graph(m1=5, m2=1) In [10]: nx.betweenness_centrality(G) Out[10]: {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.5333333333333333, 5: 0.5555555555555556, 6: 0.5333333333333333, 7: 0.0, 8: 0.0, 9: 0.0, 10: 0.0}

  23. NETWORK ANALYSIS IN PYTHON I Let’s practice!

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend