# Load¶

This tutorial shows how to load graphs from files in various formats and from existing collections of datasets, NetSet and Konect.

```
[1]:
```

```
from sknetwork.data import load_edge_list, load_graphml, load_netset, load_konect
```

## TSV files¶

Loading a graph from a TSV file (list of edges).

```
[2]:
```

```
graph = load_edge_list('miserables.tsv')
adjacency = graph.adjacency
names = graph.names
```

```
[3]:
```

```
# Digraph
graph = load_edge_list('painters.tsv', directed=True)
adjacency = graph.adjacency
names = graph.names
```

```
[4]:
```

```
# Bigraph
graph = load_edge_list('movie_actor.tsv', bipartite=True)
biadjacency = graph.biadjacency
names_row = graph.names_row
names_col = graph.names_col
```

## GraphML files¶

Loading a graph from a GraphML file.

```
[5]:
```

```
graph = load_graphml('miserables.graphml')
adjacency = graph.adjacency
names = graph.names
```

```
[6]:
```

```
# Digraph
graph = load_graphml('painters.graphml')
adjacency = graph.adjacency
names = graph.names
```

## NetSet¶

Loading a graph from the NetSets collection.

```
[7]:
```

```
graph = load_netset('openflights')
adjacency = graph.adjacency
names = graph.names
```

```
Downloading openflights from NetSet...
Unpacking archive...
Parsing files...
Done.
```

```
[8]:
```

```
# to get all fields
graph
```

```
[8]:
```

```
{'adjacency': <3097x3097 sparse matrix of type '<class 'numpy.int64'>'
with 36386 stored elements in Compressed Sparse Row format>,
'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 ]]),
'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')}
```

```
[9]:
```

```
# Digraph
graph = load_netset('wikivitals')
adjacency = graph.adjacency
names = graph.names
labels = graph.labels
```

```
Downloading wikivitals from NetSet...
Unpacking archive...
Parsing files...
Done.
```

```
[10]:
```

```
# Bigraph
graph = load_netset('cinema')
biadjacency = graph.biadjacency
```

```
Downloading cinema from NetSet...
Unpacking archive...
Parsing files...
Done.
```