CarloLucibello / GraphNeuralNetworks.jl

Graph Neural Networks in Julia
https://carlolucibello.github.io/GraphNeuralNetworks.jl/dev/
MIT License
220 stars 46 forks source link

feat: Add empty constructor for GNNHeteroGraph #358

Closed askorupka closed 8 months ago

askorupka commented 8 months ago

Adding empty constructor for GNNHeteroGraph so that g = GNNHeteroGraph() is working. This fixes #338.

g = GNNHeteroGraph()
GNNHeteroGraph:
  num_nodes: Dict()
  num_edges: Dict()
CarloLucibello commented 8 months ago

Thanks, looks good. The coverage has decreased because tests should be added to "test/GNNGraphs/gnnheterograph.jl". The test could be something like this

g = GNNHeterograph()
@test isempty(g.num_nodes)
g = add_edges(g, (:user, :like, :actor) => ([1,2,3,3,3], [3,5,1,9,4]))
@test g.num_nodes[:user] == 3
@test g.num_nodes[:actor] == 9
@test g.num_edges[(:user, :like, :actor)] == 5
...