# Crystal Graphs w/ GeometricFlux.jl

**URL:** <https://discourse.julialang.org/t/crystal-graphs-w-geometricflux-jl/109773>\
**Category:** Machine Learning\
**Tags:** geometricflux\
**Created:** [February 6, 2024, 12:25am UTC](https://discourse.julialang.org/t/crystal-graphs-w-geometricflux-jl/109773 "2024-02-06T00:25:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_Bringuier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefan_bringuier/32/20132_2.png) [@Stefan\_Bringuier](https://discourse.julialang.org/u/Stefan_Bringuier)\
**Post date:** [February 6, 2024, 12:25am UTC](https://discourse.julialang.org/t/crystal-graphs-w-geometricflux-jl/109773/1 "2024-02-06T00:25:40Z")

</div>

I’m fairly new to [GeometricFlux.jl](https://github.com/FluxML/GeometricFlux.jl) and working on trying to implement the Crystal Graph CNN approach by [Xie and Grossman](https://arxiv.org/abs/1710.10324). I have the following `FeaturedGraph, target` pair dataset. I guess what I’m wondering is 1.) How should one do the batching? Does `DataLoader(train_data, batchsize=3, shuffle=true, collate=true)` make sense? 2.) In the CGCNN paper the edge features tied to a node are concatenated, how should I do that?

```julia

Tuple{GraphSignals.FeaturedGraph{GraphSignals.SparseGraph{false, SparseArrays.SparseMatrixCSC{Int64, Int64}, Vector{Int64}, Int64}, GraphSignals.NodeSignal{Matrix{Float64}}, GraphSignals.EdgeSignal{Matrix{Float64}}, GraphSignals.NullGraphSignal, GraphSignals.NullDomain}, Float64}
FeaturedGraph:
	Undirected graph with (#V=22, #E=179) in adjacency matrix
	Node feature:	ℝ^92 <NodeSignal{Matrix{Float64}}>
	Edge feature:	ℝ^10 <EdgeSignal{Matrix{Float64}}>
3.6833
FeaturedGraph:
	Undirected graph with (#V=40, #E=400) in adjacency matrix
	Node feature:	ℝ^92 <NodeSignal{Matrix{Float64}}>
	Edge feature:	ℝ^10 <EdgeSignal{Matrix{Float64}}>
1.6222
FeaturedGraph:
	Undirected graph with (#V=12, #E=58) in adjacency matrix
	Node feature:	ℝ^92 <NodeSignal{Matrix{Float64}}>
	Edge feature:	ℝ^10 <EdgeSignal{Matrix{Float64}}>
1.5476
FeaturedGraph:
	Undirected graph with (#V=80, #E=1111) in adjacency matrix
	Node feature:	ℝ^92 <NodeSignal{Matrix{Float64}}>
	Edge feature:	ℝ^10 <EdgeSignal{Matrix{Float64}}>
2.1634
FeaturedGraph:
	Undirected graph with (#V=9, #E=45) in adjacency matrix
	Node feature:	ℝ^92 <NodeSignal{Matrix{Float64}}>
	Edge feature:	ℝ^10 <EdgeSignal{Matrix{Float64}}>
3.2824
FeaturedGraph:
	Undirected graph with (#V=19, #E=170) in adjacency matrix
	Node feature:	ℝ^92 <NodeSignal{Matrix{Float64}}>
	Edge feature:	ℝ^10 <EdgeSignal{Matrix{Float64}}>
1.8759
FeaturedGraph:
	Undirected graph with (#V=16, #E=84) in adjacency matrix
	Node feature:	ℝ^92 <NodeSignal{Matrix{Float64}}>
	Edge feature:	ℝ^10 <EdgeSignal{Matrix{Float64}}>
1.4667
FeaturedGraph:
	Undirected graph with (#V=48, #E=720) in adjacency matrix
	Node feature:	ℝ^92 <NodeSignal{Matrix{Float64}}>
	Edge feature:	ℝ^10 <EdgeSignal{Matrix{Float64}}>
3.7994
FeaturedGraph:
	Undirected graph with (#V=6, #E=21) in adjacency matrix
	Node feature:	ℝ^92 <NodeSignal{Matrix{Float64}}>
	Edge feature:	ℝ^10 <EdgeSignal{Matrix{Float64}}>
0.0
...

```

Any guidance on general tips on setting up and training GNN with GeometricFlux.jl is much appreciatd.
