2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

networkxでSNSのつながりをグラフ化

Posted at

データのダウンロード

!wget https://snap.stanford.edu/data/facebook_combined.txt.gz
!gunzip facebook_combined.txt.gz

グラフの表示

import numpy
import matplotlib.pyplot as plt
import networkx as nx

# データの読み込み
G = nx.read_edgelist("facebook_combined.txt")

# 描画
pos = nx.spring_layout(G)
plt.figure(figsize=(10, 10), dpi=200)

nx.draw_networkx(G, pos, node_size=1, with_labels=False, edge_color='gray', width=0.1)

plt.show()

image.png

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?