数据集
本教程展示了如何从 NetSet 集合中加载图。
[1]:
from sknetwork.data import load_netset
NetSet
从 NetSet 集合中加载图。
[2]:
dataset = load_netset('openflights')
adjacency = dataset.adjacency
names = dataset.names
Downloading openflights from NetSet...
Unpacking archive...
Parsing files...
Done.
[3]:
# to get all fields
dataset
[3]:
{'adjacency': <3097x3097 sparse matrix of type '<class 'numpy.int64'>'
with 36386 stored elements in Compressed Sparse Row format>,
'meta': {'name': 'openflights',
'description': 'Airports with daily number of flights between them.',
'source': 'https://openflights.org'},
'names': array(['Goroka Airport', 'Madang Airport', 'Mount Hagen Kagamuga Airport',
..., 'Saumlaki/Olilit Airport', 'Tarko-Sale Airport',
'Alashankou Bole (Bortala) airport'], dtype='<U65'),
'position': array([[145.39199829, -6.08168983],
[145.78900147, -5.20707989],
[144.29600525, -5.82678986],
...,
[131.30599976, -7.98860979],
[ 77.81809998, 64.93080139],
[ 82.3 , 44.895 ]])}
[4]:
# Directed graph
dataset = load_netset('wikivitals')
adjacency = dataset.adjacency
names = dataset.names
labels = dataset.labels
Downloading wikivitals from NetSet...
Unpacking archive...
Parsing files...
Done.
[5]:
# Bipartite graph
dataset = load_netset('cinema')
biadjacency = dataset.biadjacency
Downloading cinema from NetSet...
Unpacking archive...
Parsing files...
Done.