Reputation: 179
in reference to this Link : Change Size/Color of Vertex in JUNG
I am trying to simulate Dijkstra algorithm visually using JUNG. i can get set of Edges and end points of each Edge using built in Dijkstra algorithm in library. but my question is if i want to change the color of shortest path(Color of Edges and vertices in shortest path) at run-time how do i do that?
Upvotes: 0
Views: 769
Reputation: 176
Transformer<String, Paint> edgePaint = new Transformer<String, Paint>() {
@Override
public Paint transform(String s) { // s represents the edge
if (...){ // your condition
return Color.RED;
}
else {
return Color.DARK_GRAY;
}
}
};
// vv is the VirtualizationViewer
vv.getRenderContext().setEdgeDrawPaintTransformer(edgePaint);
`
Upvotes: 1