MiRA › Data format
MiRA reads a multilayer network as either a single JSON file or a set of CSV files. Both describe the same thing: layers, nodes, an edge list that holds intralayer and interlayer links together, and the (layer, node) pairs that make up the network. This page is the quick reference; the manual has the exhaustive version.
A MiRA JSON file has four arrays — layers, nodes,
extended (the edge list), and state_nodes — plus global flags.
An edge is classified as intralayer when layer_from equals layer_to,
and interlayer otherwise.
{
"directed": false,
"directed_interlayer": false,
"layers": [
{ "layer_id": 1, "layer_name": "Forest",
"latitude": 42.3, "longitude": 3.1,
"bipartite": true, "setA_type": "pollinator" }
],
"nodes": [
{ "node_id": "sp_1", "node_name": "Bee", "node_type": "pollinator" }
],
"extended": [
{ "layer_from": "Forest", "node_from": "Bee",
"layer_to": "Forest", "node_to": "Flower", "weight": 1.5 }
],
"state_nodes": [
{ "layer_name": "Forest", "node_name": "Bee" }
]
}
directed (Boolean) — marks intralayer edges as directed (draws
arrowheads). Setting it true also forces directed_interlayer true.
Default false.directed_interlayer (Boolean, optional) — treats interlayer edges as
directed even when the network is otherwise undirected (useful for temporal networks where
direction encodes time, e.g. year t → t+1).layers[] — layer_id, layer_name; optional
latitude/longitude (unlock Map
Mode); optional bipartite and setA_type (see below). Extra
fields become color/size attributes.nodes[] — node_id, node_name; node_type
is required for bipartite layers. Extra fields become physical attributes (constant
across layers).extended[] — layer_from, node_from,
layer_to, node_to (required); optional weight (line
width + threshold filter) and per-edge directed.state_nodes[] — layer_name, node_name for every
(layer, node) pair present. Extra fields become per-layer (state) attributes that
can differ for the same node across layers (e.g. abundance,
module)."bipartite": true and give its nodes a node_type with exactly two
distinct values within that layer. Use setA_type to pin which type is
drawn on top (by ecological convention the higher trophic level — pollinator, parasite,
disperser). Different layers may pair different node types (diagonal coupling), so more than
two node_type values globally is fine.
The CSV importer accepts up to four files. Only the edge list is required; the other three add attributes. Comma, tab, and semicolon delimiters are auto-detected.
layer_from,
node_from, layer_to, node_to, optional
weight. Intralayer and interlayer links share this one file.layer_id,
layer_name, latitude, longitude,
bipartite (TRUE/FALSE), setA_type, plus any extra layer columns.node_name (required),
node_type (required when any layer is bipartite), plus physical attributes
constant across layers (e.g. body_mass, guild).layer_name,
node_name, plus per-layer attributes that vary across layers (e.g.
abundance, module).layer_from,node_from,layer_to,node_to,weight
1982,Apodemus_agrarius,1982,Ixodes_ricinus,1
1982,Apodemus_peninsulae,1982,Ixodes_ricinus,1
1983,Apodemus_agrarius,1983,Ixodes_ricinus,1
The (layer, node) pairs are derived automatically from the edge list — you never list them by hand. See the manual for the full four-file example with per-layer abundance.
multilayer_to_json(net, bipartite = TRUE)
and multilayer_to_csv(net, path = "my_network/") — or plots straight into MiRA
with plot_multilayer().