You need to call a label transformer for your vertex/edge:
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
This is something you'd find pretty often in the samples. It uses the toString() method of your vertex class to specify the label.
A slightly more involved example:
vv.getRenderContext().setEdgeLabelTransformer(new Transformer<MyEdge, String>() {
public String transform(MyEdge e) {
return (e.toString() + " " + e.getWeight() + "/" + e.getCapacity());
}
});
You don't need to iterate over the edges; the EdgeLabelTransformer or VertexLabelTransformer will label your edges as and when their properties are updated, and the VisualizationViewer will update them on the fly.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…