Skip to content

A package for downloading and working with graph datasets

License

Notifications You must be signed in to change notification settings

simonschoelly/GraphDatasets.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphDatasets

Build Status Coverage

GraphDatasets.jl is a package for downloading and working with graph datasets. It currently provides the ability to download some of the datasets from graphlearning.io.

Quick example

# Load GraphDatasets
julia> using GraphDatasets

# List all available datasets
julia> list_datasets()
TUDatasets.AIDSDataset
TUDatasets.AspirinDataset
TUDatasets.BZRDataset
[...]

# Load QM9 from TUDatasets. This dataset contains 129433 molecules represented as graphs.
# The resulting ValGraphCollection is an immutable collection of graphs.
julia> qm9 = loadgraphs(TUDatasets.QM9Dataset(); resolve_categories=true)
129433-element ValGraphCollection of graphs with
              eltype: Int8
  vertex value types: (Bool, Bool, Bool, Bool, Bool, Int8, Bool, Bool, Bool, Bool, Bool, Bool, Int64, Float64, Float64, Float64)
    edge value types: (Bool, Bool, Bool, Bool)
   graph value types:= Float64, α = Float64, ϵ_HOMO = Float64, ϵ_LUMO = Float64, Δϵ = Float64, electronic_spatial_energy = Float64, ZPVE = Float64, U_0 = Float64, U = Float64, H = Float64, G = Float64, c_v = Float64, UATOM_0 = Float64, UTAM = Float64, HATOM = Float64, GATOM = Float64, A = Float64, B = Float64, C = Float64)

# We can have a look at the readme for this dataset
julia> loadreadme(TUDatasets.QM9Dataset())
README for dataset QM9
[..]

# A ValGraphCollection can be indexed to get a ValGraphCollectionView of a single graph.
julia> g = qm9[1234]
{19, 18} undirected ValGraphCollectionView with
              eltype: Int8
  vertex value types: (Bool, Bool, Bool, Bool, Bool, Int8, Bool, Bool, Bool, Bool, Bool, Bool, Int64, Float64, Float64, Float64)
    edge value types: (Bool, Bool, Bool, Bool)
   graph value types:= Float64, α = Float64, ϵ_HOMO = Float64, ϵ_LUMO = Float64, Δϵ = Float64, electronig_spatial_energy = Float64, ZPVE = Float64, U_0 = Float64, U = Float64, H = Float64, G = Float64, c_v = Float64, UATOM_0 = Float64, UTAM = Float64, HATOM = Float64, GATOM = Float64, A = Float64, B = Float64, C = Float64)

# ValGraphCollectionView inherits from Graphs.AbstractGraph and SimpleValueGraphs.AbstractValGraph
# and can therefore be used like other graph types
julia> using Graphs: diameter

julia> diameter(g)
7

# We can also convert it to a SimpleGraph without keeping the metadata
julia> SimpleGraph(g)
{19, 18} undirected simple Int8 graph

# or to a ValGraph
julia> ValGraph(g)
{19, 18} undirected ValGraph with
              eltype: Int8
  vertex value types: (Bool, Bool, Bool, Bool, Bool, Int8, Bool, Bool, Bool, Bool, Bool, Bool, Int64, Float64, Float64, Float64)
    edge value types: (Bool, Bool, Bool, Bool)
   graph value types:= Float64, α = Float64, ϵ_HOMO = Float64, ϵ_LUMO = Float64, Δϵ = Float64, electronig_spatial_energy = Float64, ZPVE = Float64, U_0 = Float64, U = Float64, H = Float64, G = Float64, c_v = Float64, UATOM_0 = Float64, UTAM = Float64, HATOM = Float64, GATOM = Float64, A = Float64, B = Float64, C = Float64)

Alternatives

References

[1]: Morris, Christopher, Nils M. Kriege, Franka Bause, Kristian Kersting, Petra Mutzel, and Marion Neumann. "Tudataset: A collection of benchmark datasets for learning with graphs." arXiv preprint arXiv:2007.08663 (2020).