[Top][All Lists]

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

[igraph] Python iGraph: Create graph from numpy / pandas dataframe

From: Nick Eubank
Subject: [igraph] Python iGraph: Create graph from numpy / pandas dataframe
Date: Sat, 15 Apr 2017 21:30:36 +0000

Hell All,

I'm trying to figure out the most efficient way of creating an igraph object form an edgelist stored in a numpy array (or rather, technically, a pandas DataFrame). 

The DataFrame looks something like:

    a        b           weight
    100    101       1
    100    102       5
    101    103       1
    101    104       4

The numbers in a and b are NOT sequential integers, though I can write code to make those conversion if necessary. 

One option is obviously to write out the data frame as a text file, then re-import as an ncol or such. But my dataset is very large (the edgelist has about 400,000,000 entries), which means that's a massively slow process, and I think loading the text file when importing into igraph may be requiring more ram than I have. 

I've found resources on importing adjacency matrices, but nothing on edgelists. 

Anyone run into this before / have any suggestions?



reply via email to

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