[SOLVED] generating networks from data matrices

Get help with your data
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
khavens
Posts:2
Joined:07 Jun 2011 19:01
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[SOLVED] generating networks from data matrices

Post by khavens » 07 Jun 2011 19:08

Hello. I am an ecologist who studies the structure and function of food webs. I wanted to use Gelpi to better understand how plankton food webs are structured along a gradient of pollution stress. Yes, a Gelpi newbee -- in fact a network analysis newbee.

The software seems intuitive and useful, however, my data consist of matrices of 0 and 1 values between predators and their prey (1 = predation, 0 = lack of predation). So for example in a very simple case with two predators (species A, B) and two prey eaten by them (C, D), the data matrix would look like this and exists as a .txt file:

A B

C 1 1
D 1 1

My actual matrices are much more complex, with up to 50 species and hundreds of links.

How do I bring data like this into Gelpi? Or can I? Is there some process that I must do first to create the network diagrams?

admin
Gephi Community Manager
Posts:964
Joined:09 Dec 2009 14:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: generating networks from data matrices

Post by admin » 07 Jun 2011 20:15

Welcome here!

Write your matrix as a DL file (see this page), and load the data as explained in the Quick Start tutorial.

Cheers!

elijah
Gephi Community Support
Posts:169
Joined:11 Sep 2010 18:09
Location:Stanford, CA
Contact:

Re: generating networks from data matrices

Post by elijah » 07 Jun 2011 20:37

Your matrix is already a graph, you just need to pivot it:
ABCD
A 0110
B 1000
C 1101
D 0100

Can be represented in one of two ways. You can either only map the predation connections, which could be outputed as a simple CSV:

A,B,C
B,A
C,A,B,D
D,B

(Remember, Gephi's CSV import expects source, target, target, target, target, etc for each line)

Or you can map each type of connection with the predator/prey distinction as an edge type:
Source Target Type
A, A, 0
A, B, 1
A, C, 1
A, D, 0
B, A, 1
B, B, 0
B, C, 0
B, D, 0

How you get there from your data depends on its actual format and the method you're most comfortable with using to transform data. You can write this as a script, or use a tool like Data Wrangler or even do it in Excel if it's not too many columns.

khavens
Posts:2
Joined:07 Jun 2011 19:01
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: generating networks from data matrices

Post by khavens » 07 Jun 2011 21:19

THANK YOU FOR THE HELP ! :D

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable