create a multilayer network from a group of data.frames

Hi all,

Is there a way to create a multilayer network from a group of data.frames?

This would make it very easy to import data to create multigraphs in
graph-tool. This is possible for example in igrap library and for MuxViz in
R( https://github.com/manlius/muxViz).

In Muxviz, for example, one can create a multilayer network using three
data.frames. I copy some of the explanation below from their documentation:

### Node list

One df with following columns :

   - nodeID: [mandatory] numerical integer id to identify each node
   - nodeLabel: [optional] string specifying the label attribute
   - nodeX: [optional] float value specifying the Cartesian coordinate x
   for the layout
   - nodeY: [optional] float value specifying the Cartesian coordinate x
   for the layout
   - nodeLat: [optional] float value specifying the latitude for the
   geographic layout
   - nodeLong: [optional] float value specifying the longitude for the
   geographic layout

### Edges list

One or more df with data on the edges. A typical edges list is expected to
be a file with at most three columns, giving the list of edges from a node
(first column) to other nodes (second column), possibly weighted by an
integer or floating number (third column). For instance:

1 2 0.5
1 3 1.4
...
18 124 0.1

### input df

Muxviz also uses a third data.frame that brings information on the list of
layers to be included in a multiplex, the corresponding labels and the
possible layout file to define node properties (e.g., ID, labels,
geographic coordinates, etc).

best wishes,

Rafael H M Pereira

attachment.html (2.08 KB)

Please take a look at the Graph.add_edge_list() function:

https://graph-tool.skewed.de/static/doc/graph_tool.html#graph_tool.Graph.add_edge_list

This function is versatile enough to provide the functionality you mention.

Best,
Tiago

I'll have a look, Tiago! Thank you.

best,

Rafael H M Pereira

attachment.html (1.5 KB)