부분 그래프

Python으로 시작하는 네트워크 분석

Eric Ma

Data Carpentry instructor and author of nxviz package

부분 그래프

  • 큰 그래프의 일부를 시각화
    • 경로
    • 커뮤니티/클릭
    • 특정 노드로부터의 분리 정도
Python으로 시작하는 네트워크 분석

부분 그래프

import networkx as nx
G = nx.erdos_renyi_graph(n=20, p=0.2)

G.nodes()
NodeView([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19])
nodes = list(G.neighbors(8))
nodes
[2, 3, 4, 10]
nodes.append(8)
Python으로 시작하는 네트워크 분석

부분 그래프

G_eight = G.subgraph(nodes)

G_eight.edges()
EdgeView([(8, 2), (8, 3), (8, 4), (8, 10), (2, 10)])
G_eight
<networkx.classes.graph.Graph at 0x10cae39e8>
G
<networkx.classes.graph.Graph at 0x10cad1f60>
Python으로 시작하는 네트워크 분석

부분 그래프

nx.draw(G_eight, with_labels=True)

다섯 개의 노드가 있는 그래프. 크기 3의 클릭이 포함됨.

Python으로 시작하는 네트워크 분석

연습해 봅시다!

Python으로 시작하는 네트워크 분석

Preparing Video For Download...