[jgrapht-users] Use more then one same or different Edges between two nodes
Brought to you by:
barak_naveh,
perfecthash
From: Stan N. <dj-...@ar...> - 2007-06-17 17:13:23
|
Hi, jgrapht users. I trying to set more then one Edge between two nodes: my class: . . . . public class HarmoGraph { /** Creates a new instance of HarmoGraph */ public HarmoGraph() { // create a graph based on strings DefaultDirectedWeightedGraph Graph = createGraph(); System.out.println(Graph.toString()); } public DefaultDirectedWeightedGraph<String, Double> createGraph() { DefaultDirectedWeightedGraph<String, Double> g = new DefaultDirectedWeightedGraph(DefaultEdge.class); String T = "T"; String S = "S"; String D = "D"; String Tp = "Tp"; String Dp = "Dp"; String Sp = "Sp"; String Dv = "Dv"; String D7 = "D7"; // add the vertices g.addVertex(T); g.addVertex(S); g.addVertex(D); g.addVertex(Tp); g.addVertex(Dp); g.addVertex(Sp); g.addVertex(Dv); g.addVertex(D7); // g.setEdgeWeight(e1, 10); //Hier setting Edges between Nodes //Another directions has an another Edge //between the same nodes. g.addEdge(D, T, 2.0); g.addEdge(T, S, 1.0); g.addEdge(S, T, 1.0); g.addEdge(S, D, 1.0); g.addEdge(D, S, 1.0); g.addEdge(T, D, 3.0); return g; } } //End Class. I do not understand, why I become this output: ([T, S, D, Tp, Dp, Sp, Dv, D7], [2.0=(D,T), 1.0=(T,S), 3.0=(T,D)]) Where are my another Edges = 1.0 between (S, T), (S, D) and (D, S)? Best regards and thanks a lot. Stan |