[Solved] Dynamic graphs and edge aggregation

Once it's running
Vongow
Posts:10
Joined:28 May 2014 10:33
Location:France
[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] Dynamic graphs and edge aggregation

Post by Vongow » 13 Jun 2014 10:48

Hi there,

I'm currently working on dynamic graphs with Gephi (that's quite a surprise, isn't it ?) and I'm facing a very common (I guess) issue, but I wasn't able to find a solution, neither on this forum nor on the Internet.

The data I use to build my graph is composed by :
A list of nodes (id, label, etc., date of birth). I use DoB to build a time interval column (one-bound).
A list of edges (source, target, etc., date/time). I use date to build a time interval column (two-bounds).
The semantic of my edge list can be seen like a phone call between two nodes. Therefore, there can be multiple occurrences of one edge, but at different times.
Example :

Code: Select all

Src   Trgt  Time
 1     2     42
 1     3     44
 1     3     73
 1     4     37
 2     1     13
When I import my data within the Data Lab, the edges are aggregated (and given a weight) automatically.
For the previous example data it would give me :

Code: Select all

Src   Trgt  Time  Weight
 1     2     42      1
 1     3     44      2   
 1     4     37      1
 2     1     13      1
I lose a lot of information here : when I go to dynamic view, the edge weights remain steady and the call frequency over a period can't be seen.

My question is : how can I import my data so that I don't loose information ?
Last edited by Vongow on 19 Jun 2014 08:52, edited 1 time in total.

francis_flavin
Posts:68
Joined:21 Jan 2012 18:34
Location:Washington, DC, USA
[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: Dynamic graphs and edge aggregation

Post by francis_flavin » 16 Jun 2014 21:49

You might try giving each of your edges its own unique id (in a column with "Id" as the header) before importing. I suspect this will fix it.

Good luck!


Francis

Vongow
Posts:10
Joined:28 May 2014 10:33
Location:France
[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: Dynamic graphs and edge aggregation

Post by Vongow » 17 Jun 2014 15:09

Hi Francis, thank you for your answer !

Unfortunately it doesn't seem to do the trick. I tested the dataset below in data lab :

Code: Select all

Id,Source,Target,Time
1,1,2,1
2,1,2,2
3,1,2,3
4,1,2,4
5,1,3,3
6,1,3,4
7,3,1,5
8,2,1,3
9,2,1,4
10,2,3,2
Once imported, these are all the edges I have :

Code: Select all

Source Destination Type	Id Label   Weight Time
	1		 2		Orienté	1	    	4.0	1
	1		 3		Orienté	5	    	2.0	3
	2		 1		Orienté	8		    2.0	3
	2		 3		Orienté	10	      1.0	2
	3		 1		Orienté	7		    1.0	5
And of course, the dynamic view won't extrapolate and recover the original data.

How can I specify that Id has to strongly identify an edge ?

Thank you :)
Last edited by Vongow on 19 Jun 2014 08:50, edited 1 time in total.

francis_flavin
Posts:68
Joined:21 Jan 2012 18:34
Location:Washington, DC, USA
[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: Dynamic graphs and edge aggregation

Post by francis_flavin » 17 Jun 2014 21:37

Hi Vongow,

If you're using Gephi 0.8.2, try this for your edge list:

Id Source Target Duration Type
1 1 2 <[1.0, 4.99]> Directed
5 1 3 <[3.0, 4.99]> Directed
7 3 1 <[5.0, 5.99]> Directed
8 2 1 <[3.0, 4.99]> Directed
10 2 3 <[2.0, 3.99]> Directed


Make sure that the "Duration" field is set to type "Time Interval" during the import. You'll notice that I combined some of your edge entries to build this table.

When Gephi 0.9 comes out, it will be using time stamps rather than time intervals, and your way of entering the data might work better then.


Good luck!


Francis

Vongow
Posts:10
Joined:28 May 2014 10:33
Location:France
[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: Dynamic graphs and edge aggregation

Post by Vongow » 18 Jun 2014 10:05

Hi Francis,

Thank you again for spending time helping me.
Your example works well, but doesn't do all the trick.

Let me be more specific about my issue here :
Let's assume my data has a scheme like (Id, Source, Target, Begin, End, Type). Let's also assume two edges v1 & v2 have the same source S and the same target T, but edge v1 begins @ time t1 and ends @ t1+x, whereas edge v2 begins @ time t1+2x and ends @t1+3x.
According to this data, there shouldn't be an edge from S to T between t1+x & t1+2x.
If I import this very same data into Gephi, however, half the data is lost. All I have is an edge [ST]:[t1,t1+x]...

Example :

Code: Select all

Id,Source,Target,Start,End
1,1,2,1,3
2,1,2,5,7
3,1,2,6,9
4,1,2,12,13
==Gephi==>

Code: Select all

Source Destination Type Id Label Weight Start End
1	2	Orienté	1		4.0	1	3
Which is fundamentally false.

PS : please forgive me if I'm not making myself clear, English is not my mother tongue.

[EDIT : misuse of the word 'vertex']
Last edited by Vongow on 19 Jun 2014 08:48, edited 1 time in total.

francis_flavin
Posts:68
Joined:21 Jan 2012 18:34
Location:Washington, DC, USA
[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: Dynamic graphs and edge aggregation

Post by francis_flavin » 18 Jun 2014 18:35

Hi Vongow,

I think that the key point is that, to my understanding, the current version of Gephi does not allow for duplicate edges (defined as having the same source and target) via a CSV import. This might change at some point, or so it says elsewhere on this site.

Here's a helpful link: https://forum.gephi.org/viewtopic.php?f ... dges#p9136

In your most recent example, the import function will treat all edges as the same and, it seems, use some formula to increase the weight of that edge.

Here's a solution, I think: use "spells" if you're interested in building a .GEXF file or, if you're working with spreadsheet data, to include an edge's on/off times in the edges time interval field.

For the CSV approach, try to specify a time interval like this: "<[i1] [i2] ... [iN]>" where each interval has its own start_time and end_time specified appropriately. Note, you can use square brackets ("[" or "]") to include a start or end time, or a parenthesis ("(" or ")") to start immediately after a start time or end immediately before an end time.

Here's an example:

Code: Select all

Id	Source	Target	Duration	Type	Label
1	1	2	<[1.0, 2.0] [3.0, 4.0] (5.0, 6.0]>	Directed	Variable Dynamic Edge
2	2	3	<[0.5,6.0]>	Directed	Dynamic Edge
3	2	4	<[0.5,6.0]>	Directed	Dynamic Edge
4	3	5	<[0.5,5.0]>	Directed	Dynamic Edge
Be sure to import the "Duration" field as a field of type "Time Interval" during the import phase.

Also, one point on the description below: a "vertex" is the same as a node, but it seem like you're using it to mean "edge." I should also point out that vertices (i.e., nodes) as well as edges can be dynamic. You can specify a node's start/end times the way you would for an edge.

Good luck on this and let me know how it goes for you.


Francis

Vongow
Posts:10
Joined:28 May 2014 10:33
Location:France
[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] Dynamic graphs and edge aggregation

Post by Vongow » 19 Jun 2014 08:46

Francis,

Thank you for :
  • All your answers.
  • Your patience
  • The accuracy of your answers
  • Helping me
  • Many other things
I'm quite disappointed by the fact that this function does not exist (the edge weight that could vary with time). It was pretty important to me. Well, back to R.
Gephi is still a great software, easy to manipulate and with many possibilities.

The multiple intervals trick that you pointed out is very valuable, I didn't know it. I'll use it in other projects.

As I said, English is not my mother tongue, and sometimes I try to use fancy words instead of being simple and clear, and I shouldn't. My bad. I'll edit my previous messages.

In a nutshell, thank you Francis, and sorry for the time you wasted with me when I should have been looking for existing answers in this forum (well, actually I did but obviously not enough).

Fare well,
Vongo

francis_flavin
Posts:68
Joined:21 Jan 2012 18:34
Location:Washington, DC, USA
[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: [Solved] Dynamic graphs and edge aggregation

Post by francis_flavin » 19 Jun 2014 17:18

Hi Vongow,

Thank you for the kind note. I appreciate it very much. And, no apologies necessary for your English--it's quite good actually, and you should proud of it.

In answering your question about Gephi losing duplicate edges on a CSV import, I lost track of your requirement that edges can have different weights upon their reappearance. Let me look into that because it would help me, too. I can think of a solution that might work, but I haven't tried it yet.

Finally, I didn't "waste" any time in helping to answer your questions. It helped me, too, and because I am an enthusiastic supporter of network research and Gephi, I'm happy to help out from time to time on the forum.

Francis

TammaraBa8
Posts:1
Joined:14 Oct 2014 03:38
[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: [Solved] Dynamic graphs and edge aggregation

Post by TammaraBa8 » 14 Oct 2014 19:44

I'm grateful for being a part of this forum. I was able to import data yet not losing any information. Thanks for your help!

mars0i
Posts:13
Joined:09 Aug 2014 20:43
[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: [Solved] Dynamic graphs and edge aggregation

Post by mars0i » 20 Nov 2014 00:23

Another alternative would be to use GEXF format. This might be a lot more work to generate, but I think it can be made to do what you want. (However, I haven't tested anything that's exactly like your case. In my networks, once an edge appears, it never disappears, although its attributes change with time.)

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