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

degree centrality
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

NETWORK ANALYSIS IN PYTHON I

Degree centrality

slide-2
SLIDE 2

Network Analysis in Python I

Important nodes

  • Which nodes are important?
  • Degree centrality
  • Betweenness centrality
slide-3
SLIDE 3

Network Analysis in Python I

Important nodes

  • Which centre node might be more important?
slide-4
SLIDE 4

Network Analysis in Python I

Important nodes

  • Which centre node might be more important?
slide-5
SLIDE 5

Network Analysis in Python I

Degree centrality

  • Definition:
  • Examples of nodes with high degree centrality:
  • Twier broadcasters
  • Airport transportation hubs
  • Disease super-spreaders

Number of Neighbours I Have Number of Neighbours I Could Possibly Have

slide-6
SLIDE 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.

slide-7
SLIDE 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}

slide-8
SLIDE 8

NETWORK ANALYSIS IN PYTHON I

Let’s practice!

slide-9
SLIDE 9

NETWORK ANALYSIS IN PYTHON I

Graph algorithms

slide-10
SLIDE 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
slide-11
SLIDE 11

Network Analysis in Python I

Breadth-first search (BFS)

  • Example: Shortest path between two nodes
slide-12
SLIDE 12

Network Analysis in Python I

Breadth-first search (BFS)

  • Example: Shortest path between two nodes
slide-13
SLIDE 13

Network Analysis in Python I

Breadth-first search (BFS)

  • Example: Shortest path between two nodes
slide-14
SLIDE 14

Network Analysis in Python I

Breadth-first search (BFS)

  • Example: Shortest path between two nodes
slide-15
SLIDE 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]

slide-16
SLIDE 16

NETWORK ANALYSIS IN PYTHON I

Let’s practice!

slide-17
SLIDE 17

NETWORK ANALYSIS IN PYTHON I

Betweenness centrality

slide-18
SLIDE 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
slide-19
SLIDE 19

Network Analysis in Python I

Betweenness centrality

  • Definition:
  • Application:
  • Bridges between liberal- and conservative-

leaning Twier users

  • Critical information transfer links
  • num. shortest paths through node

all possible shortest paths

slide-20
SLIDE 20

Network Analysis in Python I

Examples

  • Singapore: Raffles Place & Jurong East

Source: hp://www.seacitymaps.com/singapore/singapore_mrt_map.jpg

slide-21
SLIDE 21

Network Analysis in Python I

Example

  • High betweenness centrality, low degree centrality?
slide-22
SLIDE 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}

slide-23
SLIDE 23

NETWORK ANALYSIS IN PYTHON I

Let’s practice!