# GeometricFlux.jl - Is there a true variable graph layer?

**URL:** <https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225>\
**Category:** Machine Learning\
**Created:** [March 15, 2021, 6:42pm UTC](https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225 "2021-03-15T18:42:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![emsal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/emsal/32/9729_2.png) [@emsal](https://discourse.julialang.org/u/emsal)\
**Post date:** [March 15, 2021, 6:42pm UTC](https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225/1 "2021-03-15T18:42:16Z")

</div>

I’m looking into using [https://github.com/yuehhua/GeometricFlux.jl](https://github.com/yuehhua/GeometricFlux.jl). I notice that as per docs page [https://yuehhua.github.io/GeometricFlux.jl/dev/basics/passgraph/](https://yuehhua.github.io/GeometricFlux.jl/dev/basics/passgraph/), to pass a variable graph you need to define the `GCNConv` layer by passing in a `FeaturedGraph` . However, the `FeaturedGraph` is constructed by taking in an adjacency matrix, meaning that you need to know the graph structure before defining the GNN. Am I missing something and does functionality exist so that a given GNN can take in more than one kind of graph structure?

---

<div class="post-metadata">

**Author:** ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Post date:** [March 15, 2021, 7:21pm UTC](https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225/2 "2021-03-15T19:21:59Z")

</div>

I think the message passing layer should work for any graphs. The docs are difficult to read for me. I have once digged deeper to compare the speed of message passing to my implementation (CPU only) based on Mill.jl ([https://ctuavastlab.github.io/Mill.jl/dev/examples/graphs/](https://ctuavastlab.github.io/Mill.jl/dev/examples/graphs/)) and it was working for any graph.

---

<div class="post-metadata">

**Author:** ![emsal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/emsal/32/9729_2.png) [@emsal](https://discourse.julialang.org/u/emsal)\
**Post date:** [March 17, 2021, 2:27am UTC](https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225/3 "2021-03-17T02:27:14Z")

</div>

What did you pass in when defining the `GCNConv` layer? Was it just defined as any adjacency matrix? That seems a bit odd.

---

<div class="post-metadata">

**Author:** ![yuehhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuehhua/32/12281_2.png) [@yuehhua](https://discourse.julialang.org/u/yuehhua)\
**Post date:** [March 17, 2021, 2:43am UTC](https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225/4 "2021-03-17T02:43:37Z")

</div>

@Tomas_Pevny Sorry for the reading difficulty of documentation. There must be some room to improve.

@emsal When using a variable graph, you don’t need to give a `FeaturedGraph` to construct a `GCNConv` layer. Just use it as input for `GCNConv` layer. Use `FeaturedGraph` to contain your feature with different graph structure.

---

<div class="post-metadata">

**Author:** ![emsal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/emsal/32/9729_2.png) [@emsal](https://discourse.julialang.org/u/emsal)\
**Post date:** [March 17, 2021, 2:55am UTC](https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225/5 "2021-03-17T02:55:21Z")

</div>

Thank you, that makes sense. Are there any significant effects that come from the choice of the initial adjacency matrix used to define the GCN layer?

---

<div class="post-metadata">

**Author:** ![yuehhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuehhua/32/12281_2.png) [@yuehhua](https://discourse.julialang.org/u/yuehhua)\
**Post date:** [March 17, 2021, 2:59am UTC](https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225/6 "2021-03-17T02:59:40Z")

</div>

If you would like a static graph, which means that you pass the same graph structure, to pass through your GNN model, I suggest using initialize GCN layer with a adjacency matrix. The normalized Laplacian matrix is pre-computed to reduce the computational effort.
