Statistics
| Branch: | Revision:

root / fiddle / libnetworkx.py @ 24a4abf9

History | View | Annotate | Download (448 Bytes)

1 23e90e7c Quynh PX Nguyen
import networkx as nx
2
from networkx.algorithms.centrality.betweenness import betweenness_centrality
3
from pdb import set_trace as debugger
4
5
# create simple graph
6
G = nx.Graph()
7
# G.add_edges_from([(1,2), (2,3), (2,4), (4,5)])
8
G.add_edges_from([('A','B'), ('A','F'), ('B','C'), ('B','D'), ('B','E'), ('D','E'), ('E','G'), ('E','F')])
9
10
# show the adj
11
print G.adj
12
13
# calculate betweenness centrality
14
result = betweenness_centrality(G)
15
16
debugger()
17
a = 2