Created
May 17, 2021 20:55
-
-
Save sidneyarcidiacono/3804fdc0a2def6856324118a61eb429c to your computer and use it in GitHub Desktop.
Checking out our data with pytorch-geometric
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's take a look at our data. We'll look at dataset (all data) and data (our first graph): | |
data = dataset[0] # Get the first graph object. | |
print() | |
print(f'Dataset: {dataset}:') | |
print('====================') | |
# How many graphs? | |
print(f'Number of graphs: {len(dataset)}') | |
# How many features? | |
print(f'Number of features: {dataset.num_features}') | |
# Now, in our first graph, how many edges? | |
print(f'Number of edges: {data.num_edges}') | |
# Average node degree? | |
print(f'Average node degree: {data.num_edges / data.num_nodes:.2f}') | |
# Do we have isolated nodes? | |
print(f'Contains isolated nodes: {data.contains_isolated_nodes()}') | |
# Do we contain self-loops? | |
print(f'Contains self-loops: {data.contains_self_loops()}') | |
# Is this an undirected graph? | |
print(f'Is undirected: {data.is_undirected()}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment