manipulating the node and edge properties in dynamic graph

Evolution and dynamics on networks in Gephi: UI, data formats, algorithms...
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
sepideh
Posts:5
Joined:06 Jun 2012 16:03
[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
manipulating the node and edge properties in dynamic graph

Post by sepideh » 06 Jun 2012 16:53

I have a graph which each node and edge of the graph has some properties and they can change during the lifetime of the graph based on some factors extracting and computing from the graph such as the number of neighbours of the node and their weights and … .
To implement this in Gephi I have some difficulties.
1- Should I generate my graph inside my programming or I should import two files as a node and edge file?
2- If I import my graph by an importer how can I refer to the data library or graph (node and edge) properties in my program or my module?
3- When I manipulate the data table, should I take care about the timeline (some nodes or edges can appear or disappear during the graph lifetime) or Gephi will take care of that? If I should do, how can I manage these changes in data library?
thanks

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: manipulating the node and edge properties in dynamic gra

Post by eduramiba » 06 Jun 2012 18:45

Hi,
It is ok if you set different values in intervals that don't match the time intervals of existence (appear and disappear) of the nodes/edges.
In order to create a dynamic graph you can use gexf with dynamic attributes. See example http://gexf.net/format/dynamics.html

If it is difficult for you to convert your data to proper gexf syntax, you can try to use the Import Spreadsheet feature.
Check this info https://gephi.org/users/supported-graph ... preadsheet

So for the time intervals of nodes and edges you will import a TimeInterval column with the following syntax:
<[start,end];[start,end]> With as many intervals as you want. Start and end can be dates, datetimes or timestamps (numbers).
For dynamic values it is the same syntax, with a third parameter for the value in that interval.

You would first import nodes file with their attributes to nodes table. Every node should have an id that you know. Make sure that you choose the correct type for each column in the wizard (step 2).
Then do the same for edges. Just remember that edges file needs a Source and Target column with nodes ids (matching to nodes ids in your nodes file).
[/list]

Once you have everything correctly imported I advise you to export a gexf file and work on it.

Eduardo

sepideh
Posts:5
Joined:06 Jun 2012 16:03
[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: manipulating the node and edge properties in dynamic gra

Post by sepideh » 11 Jun 2012 10:56

Thanks for your note.
I'm trying to import my gexf file in side my java program. when I run the project, Gephi starts to work but there is no sign of my graph. even the workspace, which I create in the program, are not initialized.
do you have any idea why?
thanks
here is my code relating to import file:
//Init a project - and therefore a workspace
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
pc.newProject();
Workspace workspace = pc.getCurrentWorkspace();

//Get models and controllers for this new workspace - will be useful later
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
ImportController importController = Lookup.getDefault().lookup(ImportController.class);

//Import file
Container container;
try {
File file = new File("C:/Users/sepideh/Documents/gephi/neural insight/TextFile1.gexf");
container = importController.importFile(file);
} catch (Exception ex) {
ex.printStackTrace();
return;
}

//Append imported data to GraphAPI
importController.process(container, new DefaultProcessor(), workspace);

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: manipulating the node and edge properties in dynamic gra

Post by eduramiba » 11 Jun 2012 17:56

Hi,
Are you doing that with the toolkit or as a Gephi plugin?
Where do you start running that code?

Eduardo

sepideh
Posts:5
Joined:06 Jun 2012 16:03
[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: manipulating the node and edge properties in dynamic gra

Post by sepideh » 12 Jun 2012 17:02

Hi, I'm using toolkit.
when I copied my code to the new Java project, it's working. However, as a module it does not work. when I run my module, Gephi software starts to work but nothing happens. it seams my module does not really run.

I want to add my project as a module to the Gephi.
Thanks
Sepideh

sepideh
Posts:5
Joined:06 Jun 2012 16:03
[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: manipulating the node and edge properties in dynamic gra

Post by sepideh » 20 Jun 2012 16:26

Hey,
how can I access to the weight of each edge which is neighbour of the particular node n ?
for example, in for loop below which select every neighbours, how can I access weight of edges.

for (Node m : graph.getNeighbors(n)){

sum=sum+ weight of each edge targeted in neighbours

}

many thanks
sepideh

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: manipulating the node and edge properties in dynamic gra

Post by eduramiba » 20 Jun 2012 16:35

Hi,
You can use some code like this:

Code: Select all

for (Edge e : graph.getEdges(n).toArray()) { //toArray avoids automatic lock (use if you will manipulate the graph inside the loop)
    sum = sum + e.getWeight();
}
Eduardo

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