igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Specifying multiple output nodes from 1 input node


From: Siddhartha R Dalal
Subject: [igraph] Specifying multiple output nodes from 1 input node
Date: Wed, 8 Apr 2020 08:41:08 -0400

I have many  large dataframes of the following structure with 1 input node in each row and multiple output nodes and edge weights. 
  input_node            output_nodes             edge-weights             id-attr      attribute
1    11347-5 ['64837-1', '116228-0']  [0.01001617, 0.01778383] 82249852    372856
2   116228-0             ['14328-3']                 [0.3505]                     82283186    372892
3    39644-0            ['116228-0']             [0.10184362]                 82273700    372878
4   116228-0            ['116228-0']             [0.21326264]                82278451    372887
5   116228-0 ['64827-1', '116228-0']  [0.02947139, 0.08275262] 82249816    372855
>

For example, rows 1 and 5 have 1 input node, 2 output nodes,  the corresponding 2 edge weights (they are numbers), and few attributes; rows 2 through 4 have 1 input, and 1 output, etc .
How do I read this dataframe in igraph to make a graph while retaining attributes. Typically igraph asks for the dataframe to have the first 2 columns to be individual and output nodes. This is a large dataframe where, the # of output nodes could be large in some rows.
I can imagine doing this by a "for" loop and regex. But, that would be too slow and the new dataframe would require more memory. Would appreciate any suggestions.
Thank you. Sid

reply via email to

[Prev in Thread] Current Thread [Next in Thread]