prefuse

What are prefuse data groups and how do I put nodes into them?


Many components of prefuse seem to use a String group to identify some subset of data. How do you use groups in practice? Some documentation seems to imply that a single row of data can belong to multiple groups, but I cannot work out how to make this happen.

Ideally, I could put some nodes of a graph into multiple groups, but have them each visualized once, and apply various forces and layouts to them.


Solution

  • Indeed most prefuse components such as Layout, ColorAction or the RendererFactory use group names.

    There are different types of groups:

    In order to put "some nodes of a graph into multiple groups" you can use focus groups. Then some Action may be added to run only on the focus group.

    Alternatively you could pass a Predicate to the Action, so that only items (= rows) matching the Predicate are handled by the Action.

    I recommend to look at the demos to see how this works: for example https://github.com/prefuse/Prefuse/blob/master/demos/prefuse/demos/ZipDecode.java