These border labels are derived from the toString method of the edge object. Therefore, you can create your own edge class and override the toString method so that it gives the weight of the edge.
You can create your custom rib as follows:
class MyWeightedEdge extends DefaultWeightedEdge { @Override public String toString() { return Double.toString(getWeight()); } }
And then create your graph so that the graph creates edges as instances of MyDefaultEdge and therefore only displays the edge size in the visualization:
SimpleWeightedGraph<String,MyWeightedEdge> graph = new SimpleWeightedGraph<String,MyWeightedEdge>(MyWeightedEdge.class);
source share