MiRA — Multilayer Interactive Rendering Application

MiRA › Data format

The multilayer network data format MiRA reads

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.

How do I format a multilayer network as JSON for MiRA?

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" }
  ]
}

Field reference

Bipartite is never auto-detected. Mark a layer with "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.

How do I import a multilayer network from CSV into MiRA?

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.

Worked example — edge list

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.

From R: the emln package writes both formats directly — multilayer_to_json(net, bipartite = TRUE) and multilayer_to_csv(net, path = "my_network/") — or plots straight into MiRA with plot_multilayer().