When I run the code below, it gives the error: A java.lang.IllegalArgumentException exception has occurred.
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
GraphView newView = graphModel.newView();
Graph[] newGraph = new Graph[0];
newGraph = new Graph[]{graphModel.getHierarchicalUndirectedGraph(newView)};
newGraph[0].clear();
newGraph[0].clearEdges();
Node n;
Node n2;
n = graphModel.factory().newNode();
newGraph[0].addNode(n);
n2 = graphModel.factory().newNode();
newGraph[0].addNode(n2);
newEdge = graphModel.factory().newEdge(n, n2);
newGraph[0].addEdge(newEdge);
It should work according to here: http://gephi.org/docs/api/org/gephi/gra ... Model.html
Can anybody tell me please what I am doing wrong?
How to Have A New Graph From Scratch
-
- Posts:51
- Joined:12 Oct 2011 23:01
- Location:Arkansas,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
- 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: How to Have A New Graph From Scratch
Hi,
I think this is a problem with views, I can't see what's wrong.
Anyway, you can use the main view, don't need to create a new one.
This works:
Eduardo
I think this is a problem with views, I can't see what's wrong.
Anyway, you can use the main view, don't need to create a new one.
This works:
Code: Select all
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
pc.newProject();
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
Graph graph = graphModel.getHierarchicalUndirectedGraph();
Node n;
Node n2;
n = graphModel.factory().newNode();
n2 = graphModel.factory().newNode();
Edge newEdge = graphModel.factory().newEdge(n, n2);
graph.addNode(n);
graph.addNode(n2);
graph.addEdge(newEdge);
-
- Posts:51
- Joined:12 Oct 2011 23:01
- Location:Arkansas,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: How to Have A New Graph From Scratch
Ok, will try to do that. Thanks.
-
- Posts:1
- Joined:31 Oct 2014 13:30 [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: How to Have A New Graph From Scratch
Let's call Graph A the graph with a max edge attribute (call this F) of 150 while Graph B has a max F of 250. (Also wanted to clarify I'm using an edge attribute and not the weight, which I'm not sure how is calculated)
1. Specify a two point color scale for edges for Graph A using attribute F, ends up applying to the range 1-150.
2. Run a preview, there is an edge in the graph that uses the "max" color of the scale.
3. On Graph B, added an Attribute -> Range filter, limiting range between 1-150, and then applied the same color scale.
__________________________
Scarlett
1. Specify a two point color scale for edges for Graph A using attribute F, ends up applying to the range 1-150.
2. Run a preview, there is an edge in the graph that uses the "max" color of the scale.
3. On Graph B, added an Attribute -> Range filter, limiting range between 1-150, and then applied the same color scale.
__________________________
Scarlett