Re: [jgrapht-users] VertexLabelProvider, EdgeLabelProvider not called
Brought to you by:
barak_naveh,
perfecthash
From: John V. S. <js...@gm...> - 2010-07-17 22:23:37
|
Looks like you have to call setPrintLabels() first. JVS Oliver Schrenk wrote: > Hi, > > I have some trouble printing the labels using the GmlExporter, they are simply not called. > > Any idea? > > Best regards > Oliver Schrenk > > > public Network() { > graph = new DirectedWeightedMultigraph<Node, Edge>(Edge.class); > init(); > } > > private void init() { > Node previous = new Node(1, "label_1"); > Node current = new Node(2, "label_2"); > > graph.addVertex(previous); > graph.addVertex(current); > graph.addEdge(previous, current); > > } > > public void export() { > GmlExporter<Node, Edge> exporter = new GmlExporter<Node, Edge>( > new VertexIdProvider(), new VertexLabelProvider(), > new EdgeIdProvider(), new EdgeLabelProvider()); > exporter.export(new BufferedWriter(new OutputStreamWriter(System.out)), > (DirectedGraph<Node, Edge>) graph); > > } > > class VertexIdProvider implements VertexNameProvider<Node> { > > @Override > public String getVertexName(Node node) { > return Long.toString(node.getId()); > } > > } > > class VertexLabelProvider implements VertexNameProvider<Node> { > > @Override > public String getVertexName(Node node) { > System.out.println("THIS IS NEVER CALLED"); > return node.getLabel(); > } > > } > > class EdgeIdProvider implements EdgeNameProvider<Edge> { > > @Override > public String getEdgeName(Edge edge) { > return Long.toString(edge.getId()); > } > > } > > class EdgeLabelProvider implements EdgeNameProvider<Edge> { > > @Override > public String getEdgeName(Edge edge) { > System.out.println("THIS IS NEVER CALLED"); > return edge.getLabel(); > } > > } > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > |