[Jung] Detecting Selection of Vertices in Jung

In Jung, a PickedState object provides information about which vertices have been selected. To receive notifications when verticesare selected or unselected, define an ItemListener and add it to the PickedState via addItemListener. The listener is notified whenever an item is selected or unselected (or, if you prefer the terms, picked or unpicked).

Read more of this post

[Jung] Finding Vertices on a Graph in Jung

Finding the vertex or edge at a specific point, or the set of vertices in a certain area, requires the graph’s pick support. The support is obtainable from VisualizationViewer‘s getPickSupport method. The support is actually an implementation of GraphElementAccessor and contains the following methods:

    V getVertex(Layout<V,E> layout, double x, double y);

    Collection<V> getVertices(Layout<V,E> layout, Shape rectangle);

    E getEdge(Layout<V,E> layout, double x, double y);

Read more of this post

[Jung] Controlling the Appearance of Vertices and Edges in Jung

In Jung, if you want to control of the vertices or edges, you need to provide the appropriate Transformer to the RenderContext in the BasicVisualizationServer. From the Transformer‘s documentation it is simply an interface that is “implemented by classes that transform one object into another“. In Jung the Transformer “transforms” a vertex or edge to a colour, shape, text or something else that controls their appearance.

Read more of this post