I want to change the size of a subgroup of nodes based on a certain numerical value in one of its attributes/columns. I'm using 0.8.2 toolkit as I still can't get 0.9-SNAPSHOT to build (see viewtopic.php?f=27&t=2560).
First, I didn't use a partition controller, I just copied the ranking example from the gephi toolkit examples:
- Code: Select all
Ranking valueRanking = rankingController.getModel().getRanking(Ranking.NODE_ELEMENT, myCol.getId());
AbstractSizeTransformer sizeTransformer = (AbstractSizeTransformer) rankingController.getModel().getTransformer(Ranking.NODE_ELEMENT, Transformer.RENDERABLE_SIZE);
I kept getting a NullPointerException for this, for the valueRanking itself. I had already tested that the column existed, had decent values, and was non-null. This seems related to these posts: http://forum.gephi.org/viewtopic.php?t=2527 , http://forum.gephi.org/viewtopic.php?t=2525 . I am guessing that the problem is that my attribute represented by "myCol" is null for some node types. This is deliberate and correct in my graph, but may have been causing the above error.
In case this is what's happened, I tried to modify the above code to use a partition which just points to the node which have the attribute.
- Code: Select all
PartitionController partitionController = Lookup.getDefault().lookup(PartitionController.class);
Partition p = partitionController.buildPartition(myCol, graphModel.getDirectedGraph());
RankingController rankingController = Lookup.getDefault().lookup(RankingController.class);
AbstractSizeTransformer sizeTransformer = (AbstractSizeTransformer)
However, it seems the partitionController.transform() (unlike rankingController.transform()) does not accept AbstractSizeTransformer instances as arguments, as it gives a compile error.
All I want to do is to re-size all nodes containing a particular attribute based on its numerical value. This shouldn't be hard, but I'm stymied. Can someone please help?