public void addEdge(V source, V target, E edgeValue, int weight, boolean publicEdge) { // Fix for TUSCANY-3456 // First check if we already has an edge Edge edge = getEdge(source, target); if (edge != null) { // An existing edge has higher weight, let's replace it if (edge.weight > weight) { logger.fine("An edge exists with higher weight: " + edge); removeEdge(edge); } else { // Don't add this edge logger.fine("An edge exists with lower weight: " + edge); return; } } Vertex s = getVertex(source); if (s == null) { s = new Vertex(source); vertices.put(source, s); } Vertex t = getVertex(target); if (t == null) { t = new Vertex(target); vertices.put(target, t); } edge = new Edge(s, t, edgeValue, weight, publicEdge); s.outEdges.put(t, edge); t.inEdges.put(s, edge); }
public void addEdge(V source, V target, E edgeValue, int weight, boolean publicEdge) { // Fix for TUSCANY-3456 // First check if we already has an edge Edge edge = getEdge(source, target); if (edge != null) { // An existing edge has higher weight, let's replace it if (edge.weight > weight) { logger.fine("An edge exists with higher weight: " + edge); removeEdge(edge); } else { // Don't add this edge logger.fine("An edge exists with lower weight: " + edge); return; } } Vertex s = getVertex(source); if (s == null) { s = new Vertex(source); vertices.put(source, s); } Vertex t = getVertex(target); if (t == null) { t = new Vertex(target); vertices.put(target, t); } edge = new Edge(s, t, edgeValue, weight, publicEdge); s.outEdges.put(t, edge); t.inEdges.put(s, edge); }