[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 583: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 639: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
Gephi forums •manipulating the node and edge properties in dynamic graph
Page 1 of 1

manipulating the node and edge properties in dynamic graph

Posted: 06 Jun 2012 16:53
by sepideh
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

Re: manipulating the node and edge properties in dynamic gra

Posted: 06 Jun 2012 18:45
by eduramiba
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

Re: manipulating the node and edge properties in dynamic gra

Posted: 11 Jun 2012 10:56
by sepideh
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);

Re: manipulating the node and edge properties in dynamic gra

Posted: 11 Jun 2012 17:56
by eduramiba
Hi,
Are you doing that with the toolkit or as a Gephi plugin?
Where do you start running that code?

Eduardo

Re: manipulating the node and edge properties in dynamic gra

Posted: 12 Jun 2012 17:02
by sepideh
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

Re: manipulating the node and edge properties in dynamic gra

Posted: 20 Jun 2012 16:26
by sepideh
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

Re: manipulating the node and edge properties in dynamic gra

Posted: 20 Jun 2012 16:35
by eduramiba
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