Nghiên cứu tình huống II: Trực quan hóa

Nhập môn Phân tích Mạng bằng Python

Eric Ma

Data Carpentry instructor and author of nxviz package

API của nxviz

import networkx as nx
import nxviz as nv
G = nx.erdos_renyi_graph(n=20, p=0.3)

circ = nv.circos(G, node_color_by='key', sort_by='key')
Nhập môn Phân tích Mạng bằng Python

Thành phần liên thông

Một đồ thị gồm hai tiểu đồ thị; các nút trong mỗi tiểu đồ thị kết nối với nhau, nhưng hai tiểu đồ thị không kết nối với nhau.

Nhập môn Phân tích Mạng bằng Python

API của NetworkX

import networkx as nx
G = nx.erdos_renyi_graph(n=100, p=0.03)

nx.connected_components(G)
<generator object connected_component_subgraphs at 0x10cb2c990>
list(nx.connected_components(G))
[<networkx.classes.graph.Graph at 0x10ca24588>,
 <networkx.classes.graph.Graph at 0x10ca244e0>]
for g in list(nx.connected_components(G)):
    print(len(g.nodes()))
99
1
Nhập môn Phân tích Mạng bằng Python

Hãy thực hành!

Nhập môn Phân tích Mạng bằng Python

Preparing Video For Download...