Introduction
In anemoi-graphs, graphs are built using a recipe, which is a YAML file that specifies the nodes, edges, and attributes of an encoder-processor-decoder graph. The recipe file is used to create the graphs using the command-line tool.

The main components of the recipe file are the definition of the nodes, the edges, and each of these can optionally include attributes. Here we give an overview of these specifications; more details on the available options for each are given in the following pages.
Nodes
The nodes are defined in the nodes
section of the recipe file. The
keys are the names of the sets of nodes that will later be used to
build the connections. Each nodes configuration must include a
node_builder
section describing how to define the nodes, and can
optionally include node attributes.
A simple example of the nodes definition, for two sets of nodes, looks like this:
nodes:
data:
node_builder:
_target_: anemoi.graphs.nodes.ZarrDatasetNodes
dataset: /path/to/dataset.zarr
hidden:
node_builder:
_target_: anemoi.graphs.nodes.TriNodes
resolution: 5
In this example, two sets of nodes are defined, which have been named
data
and hidden
(these names are later used to define edges).
The data
nodes have been defined based on coordinates specified in a
zarr file and the hidden nodes are specified based on
a triangular refined icosahedron algorithm.
Several methods are currently supported to create your nodes. You can use indistinctly any of these to create your data or hidden nodes:
In addition to the node_builder
section, the nodes configuration
can contain an optional section to define additional node attributes
(weights, mask, …). For example, the weights can be used to define the
importance of each node in the loss function, or the masks can be used
to build connections only between subsets of nodes. See the
attributes page for more details.
Edges
The edges
section in the recipe file defines the edges between the
nodes through which information will flow. These connections are defined
between pairs of nodes sets (source and target, specified by
source_name and target_name). There are several methods to build
these edges, including cutoff (CutOffEdges) or nearest neighbours
(KNNEdges).
For an encoder-processor-decoder graph you will need to build two sets
of edges. The first set of edges will connect the data nodes with
the hidden nodes to encode the input data into the latent space,
normally referred to as the encoder edges and represented here by the
first element of the edges
section. The second set of edges will
connect the hidden nodes with the data nodes to decode the latent
space into the output data, normally referred to as decoder edges and
represented here by the second element of the edges
section.
Graphically, the encoder-processor-decoder setup looks like this:

The corresponding recipe file chunk is as follows:
edges:
# A) Encoder connections
- source_name: data
target_name: hidden
edge_builders:
- _target_: anemoi.graphs.edges.CutOffEdges
cutoff_factor: 0.7
# B) Decoder connections
- source_name: hidden
target_name: data
edge_builders:
- _target_: anemoi.graphs.edges.KNNEdges
num_nearest_neighbours: 3
In this example, the encoder edges are defined based on the cut-off radius, whereas the decoder nodes use a k-nearest neighbours algorithm. Available methods for defining edges are:
As with the nodes, the edges can have additional attributes - see the attributes page for more details.