CarloLucibello / GraphNeuralNetworks.jl

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

feat: support weights when generating from SimpleWeightedGraph #371

Closed askorupka closed 4 months ago

askorupka commented 5 months ago

This PR add support for weights when generating from SimpleWeightedGraph. This fixes #85.

julia> srcs = [1, 2, 1]
julia> dsts = [2, 3, 3]
julia> wts = [0.5, 0.8, 2.0]
julia> g = SimpleWeightedGraph(srcs, dsts, wts)
julia> gnn_g = GNNGraph(g)

julia> get_edge_weight(gnn_g)
6-element Vector{Float64}:
 0.5
 2.0
 0.5
 0.8
 2.0
 0.8
askorupka commented 4 months ago

@CarloLucibello ready for re-review. Needed to remove test as this required putting SimpleWeightedGraphs as a dependency, which is contradictory to the point of moving them to the extension.

CarloLucibello commented 4 months ago

Needed to remove test as this required putting SimpleWeightedGraphs as a dependency, which is contradictory to the point of moving them to the extension.

SimpleWeightedGraphs can be a test dependency, you have to put it under [extras] in the Project.toml. The test can live in test/ext/GraphNeuralNetworksSimpleWeightedGraphsExt/GraphNeuralNetworksSimpleWeightedGraphsExt.jl

askorupka commented 4 months ago

@CarloLucibello may I ask for help what else is required to get rid of the error message as below during tests: update: I think I got it

Error: Error during loading of extension GraphNeuralNetworksSimpleWeightedGraphsExt of GraphNeuralNetworks, use `Base.retry_load_extensions()` to retry.
│   exception =
│    1-element ExceptionStack:
│    ArgumentError: Package GraphNeuralNetworksSimpleWeightedGraphsExt [df50fc6b-8916-5c00-b5b6-a97a04cc2331] is required but does not seem to be installed:
│     - Run `Pkg.instantiate()` to install all recorded dependencies.