[SOLVED] Dynamic position of nodes

Evolution and dynamics on networks in Gephi: UI, data formats, algorithms...
lucaciav
Posts:8
Joined:06 Oct 2011 14:36
[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 position of nodes

Post by lucaciav » 13 Oct 2011 16:23

Hi, I am new...and i'm studing Gephi for my thesis.
I'm doing a plugin for import data from my file, but before I want to understand if i can build a graph where the position of nodes can change over time and if i can use the timeline to see the movement of nodes.
I hope that it can do in some way.

very thanks, Luca.

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: Dynamic position of nodes

Post by admin » 13 Oct 2011 17:01

Hi,

Of course it's possible :)

lucaciav
Posts:8
Joined:06 Oct 2011 14:36
[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 position of nodes

Post by lucaciav » 14 Oct 2011 09:47

can you give me some link for learn it please?

thanks

User avatar
mbastian
Gephi Architect
Posts:728
Joined:10 Dec 2009 10:11
Location:San Francisco, CA
[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 position of nodes

Post by mbastian » 14 Oct 2011 17:46

Yes you can do that using Dynamic objects and Ranking.

What you need to do first is create DynamicFloat objects for your nodes with the position + time. If you encode your data in the GEXF format you can set dynamic types and already import your data. Once you have a dynamic X and Y column, which you can browse in the Data Laboratory you'll need to use it to set nodes' position in a loop.

This is the code to basically get the float value from a DynamicFloat for the current interval defined in the Timeline. Attributable is either a node or an edge.

Code: Select all

AttributeColumn myDynamicXColumn = ...;
Attributable attributable = ...
DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class);
DynamicModel dynamicModel = dynamicController.getModel();
TimeInterval visibleInterval = dynamicModel.getVisibleInterval();
Estimator = dynamicModel.getNumberEstimator();
DynamicType<? extends Number> dynamicType = (DynamicType<? extends Number>) attributable.getAttributes().getValue(myDynamicXColumn.getIndex());
if (dynamicType != null) {
   return (Number) dynamicType.getValue(timeInterval == null ? Double.NEGATIVE_INFINITY : timeInterval.getLow(),
                        timeInterval == null ? Double.POSITIVE_INFINITY : timeInterval.getHigh(), estimator);
}

lucaciav
Posts:8
Joined:06 Oct 2011 14:36
[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 position of nodes

Post by lucaciav » 15 Oct 2011 13:53

very thanks..
now i'm studing your code..

lucaciav
Posts:8
Joined:06 Oct 2011 14:36
[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 position of nodes

Post by lucaciav » 17 Oct 2011 16:37

Sorry me, but have three days that I try to understand how i can create DynamicFloat objects for my nodes with the position + time.
Can you post the code in GEXF format of a simple graph with only one node but that it change the position over the time with the use of timeline? please.
For instance: I want build a simple graph where a node change the position:
x = 0 in the time [0,100],
x position = 10 in [101,200],
and x position = 20 in [202,300].
How can i do it?


For instance i have this declaration of a colunm in my container:

Code: Select all

AttributeColumn dynamicPosX = container.getAttributeModel().getNodeTable().addColumn("DynPosX", AttributeType.DYNAMIC_DOUBLE);
now my container have e new column, but how can i collegate the dynamicPosX with the property Position X?

and i don't understand how to pratically make when you say"the Data Laboratory you'll need to use it to set nodes' position in a loop"


..sorry for my bad english and thanks a lot for the help

lucaciav
Posts:8
Joined:06 Oct 2011 14:36
[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 position of nodes

Post by lucaciav » 19 Oct 2011 16:58

I think that i have understand what you want tell me now..

But can you tell me in which part of code of gephi i put this loop for take the current interval defined in the Timeline and modify the position of nodes?

User avatar
eduramiba
Gephi Code Manager
Posts:1064
Joined:22 Mar 2010 15:30
Location:Madrid, Spain
[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 position of nodes

Post by eduramiba » 20 Oct 2011 12:20

Hi,

If you are creating a plugin, I think you would have a loop that uses dynamic columns (x, y, z(optional?)) values at different time intervals and manually sets nodes positions.

Also, I think this could be a Layout plugin that uses the current time interval filtering.

Eduardo

lucaciav
Posts:8
Joined:06 Oct 2011 14:36
[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 position of nodes

Post by lucaciav » 20 Oct 2011 14:50

Thanks for the answear.. :idea:
I'll try to do a layout plugin.
hope it works

lucaciav
Posts:8
Joined:06 Oct 2011 14:36
[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 position of nodes

Post by lucaciav » 27 Oct 2011 12:40

I need to know two more things and I think I'm done. (finally) :)
1) How can I capture the scroll and enlargement event of the timeline in my layout plugin? This will allow me to change the position of the nodes while i scroll the timeline.
2) can I set a background to my workspace in gephi? I would like to put the image of a map (the map of my university)

if necessary i can open two separate tread

thanks again and I hope that i don't have tired you.

Luca.

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