CODE:
String id = node.getNodeData().getId();graph.getNeighbors(graph.getNode(id));
Statistics:Posted by mbastian — 19 Aug 2010 15:50
CODE:
String id = node.getNodeData().getId();
CODE:
graph.getNeighbors(id);
CODE:
node.getId()
Statistics:Posted by Warlax — 19 Aug 2010 15:16
Sorry I don't get that, please show me more of your code so I can understand what is the problem.In other words, what if I use the ID I get from node.getNodeData().getId() in another method which has no sense of the 'node' object? I can't use graph.getNode( ) as that relies on the ID one would get from node.getId( ) -- I am dumbfounded - don't know how to proceed.
I see an issue with your code, don't call NodeIterator.next() without calling NodeIterator.hasNext() before. That would return wrong nodes....and re-opening the same graph file into a separate workspace, do I still get that the node I removed is not a neighbor of any of the nodes it used to be neighbor of, even though it clearly exists in the new graph?
Statistics:Posted by mbastian — 19 Aug 2010 08:31
CODE:
NodeIterator iter = graph.getNodes().iterator(); Node node = iter.next(); int id = node.getID(); removeNode(id); . . . public void removeNode(int id) { graph.remove(graph.getNode(id)); }
Statistics:Posted by Warlax — 18 Aug 2010 17:42
Yes Gephi has two IDs, one internal the system is maintaining and one coming from import. You should use NodeData.getId() to get the one you have in the GEXF file. I'll complete the documentation of the Node.getId() to inform better users about the existence of the other identifier.While debugging, it came to my attention that there's some internal ID number for each node that is completely different than the one visible in the data table view (an attribute value read from the gexf file) and from the one returned in Node.getId( ).
Statistics:Posted by mbastian — 18 Aug 2010 08:28
CODE:
GraphController graphController = Lookup.getDefault().lookup(GraphController.class); ProjectController pc = Lookup.getDefault().lookup(ProjectController.class); GraphModel model = graphController.getModel(); UndirectedGraph graph = model.getUndirectedGraph();
Statistics:Posted by Warlax — 18 Aug 2010 04:46