Computing metrics, community detection and data handling
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
-
gsthakur - Posts:2
- Joined:31 May 2016 02:11
[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
Adding attribute latitude and longitude
Post
by gsthakur » 31 May 2016 02:15
Can some one help me use Java API (0.9x) to add two attributes - latitude and longitude ?
I am unable to add them using the Java API.
current snapshot of the code looks below. I want to add two attributes to this code.
Code: Select all
// Init a project - and therefore a workspace
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
pc.newProject();
Workspace workspace = pc.getCurrentWorkspace();
// Get a graph model - it exists because we have a workspace
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
Node v1 = graphModel.factory().newNode(source);
v1.setLabel(source);
-
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
Post
by eduramiba » 31 May 2016 08:12
HI,
You need to use setAttribute of elements (nodes and edges).
https://gephi.org/gephi/0.9.1/apidocs/o ... ement.html
-
gsthakur - Posts:2
- Joined:31 May 2016 02:11
[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
Post
by gsthakur » 01 Jun 2016 20:56
Thank you very much. It worked. Need to lookup the Table as well and add columns
Code: Select all
Table table = Lookup.getDefault().lookup(Table.class);
table = graphModel.getNodeTable();
table.addColumn("latitude", Double.class);
table.addColumn("longitude", Double.class);
.......
.......
Node v1 = graphModel.factory().newNode(source);
v1.setLabel(source);
v1.setAttribute("latitude", 34.56);
v1.setAttribute("longitude", 22.34);
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