protected boolean isCutEdge(Edge e) { return cutAttribute != null && e.hasAttribute(cutAttribute); }
/** * The weight of an edge. * @param e The edge. * @return The weight of the edge. */ protected double weight(Edge e) { if (!e.hasAttribute(context.weightAttribute)) return 1.0; return e.getNumber(context.weightAttribute); } }
/** * The weight of an edge. * @param e The edge. * @return The weight of the edge. */ protected double weight(Edge e) { if (!e.hasAttribute(context.weightAttribute)) return 1.0; return e.getNumber(context.weightAttribute); } }
if ((cutAttribute != null) ? (!e.hasAttribute(cutAttribute)) : true) { Node n2 = e.getOpposite(n);
/** * The weight of the edge between 'from' and 'to'. * * @param from * The origin node. * @param to * The target node. * @return The weight on the edge between 'form' and 'to'. */ public double weight(Node from, Node to) { Edge edge = from.getEdgeBetween(to.getId()); if (edge != null) { if (edge.hasAttribute(weightAttributeName)) return edge.getNumber(weightAttributeName); else return 1.0; } else { return 0.0; } }
/** * The weight of the edge between 'from' and 'to'. * * @param from * The origin node. * @param to * The target node. * @return The weight on the edge between 'form' and 'to'. */ public double weight(Node from, Node to) { Edge edge = from.getEdgeBetween(to.getId()); if (edge != null) { if (edge.hasAttribute(weightAttributeName)) return edge.getNumber(weightAttributeName); else return 1.0; } else { return 0.0; } }
} else { for (Edge e : graph.getEdgeSet()) { if (e.hasAttribute(weightMarker)) { edgeCount += (Double) e.getAttribute(weightMarker);
if (capArray.length > 1) capacities[i + n] = ((Number) capArray[1]).doubleValue(); } else if (e.hasAttribute(capacityAttribute)) System.err.printf("unknown capacity type \"%s\"\n", e .getAttribute(capacityAttribute).getClass());
} else { for (Edge e : graph.getEdgeSet()) { if (e.hasAttribute(weightMarker)) { edgeCount += (Double) e.getAttribute(weightMarker);
if (capArray.length > 1) capacities[i + n] = ((Number) capArray[1]).doubleValue(); } else if (e.hasAttribute(capacityAttribute)) System.err.printf("unknown capacity type \"%s\"\n", e .getAttribute(capacityAttribute).getClass());
if (weightMarker == null) edgeCount++; else if (edge.hasAttribute(weightMarker)) edgeCount += (Double) edge .getAttribute(weightMarker); if (weightMarker == null) edgeCount++; else if (edge.hasAttribute(weightMarker)) edgeCount += (Double) edge .getAttribute(weightMarker);
if (weightMarker == null) edgeCount++; else if (edge.hasAttribute(weightMarker)) edgeCount += (Double) edge .getAttribute(weightMarker); if (weightMarker == null) edgeCount++; else if (edge.hasAttribute(weightMarker)) edgeCount += (Double) edge .getAttribute(weightMarker);
protected void mouseButtonPress(MouseEvent event) { view.requestFocus(); // Unselect all. if (!event.isShiftDown()) { if (types.contains(InteractiveElement.NODE)) { for (Node node : graph) { if (node.hasAttribute("ui.selected")) node.removeAttribute("ui.selected"); } } if (types.contains(InteractiveElement.SPRITE)) { for (GraphicSprite sprite : graph.spriteSet()) { if (sprite.hasAttribute("ui.selected")) sprite.removeAttribute("ui.selected"); } } if (types.contains(InteractiveElement.EDGE)) { for (Edge edge : graph.getEdgeSet()) { if (edge.hasAttribute("ui.selected")) edge.removeAttribute("ui.selected"); } } } }
/** * Create the new information and put in it all the paths between this * node and all its direct neighbours. * * @param node * The node to start from. * @param weightAttributeName * The key used to retrieve the weight attributes of edges. * This attribute but store a value that inherit Number. * @param directed * If false, the edge orientation is not taken into account. */ public APSPInfo(Node node, String weightAttributeName, boolean directed) { double weight = 1; Iterable<? extends Edge> edges = node.getLeavingEdgeSet(); source = node; if (!directed) edges = node.getEdgeSet(); for (Edge edge : edges) { Node other = edge.getOpposite(node); if (edge.hasAttribute(weightAttributeName)) weight = edge.getNumber(weightAttributeName); targets.put(other.getId(), new TargetPath(other, weight, null)); } }
/** * Create the new information and put in it all the paths between this * node and all its direct neighbours. * * @param node * The node to start from. * @param weightAttributeName * The key used to retrieve the weight attributes of edges. * This attribute but store a value that inherit Number. * @param directed * If false, the edge orientation is not taken into account. */ public APSPInfo(Node node, String weightAttributeName, boolean directed) { double weight = 1; Iterable<? extends Edge> edges = node.getLeavingEdgeSet(); source = node; if (!directed) edges = node.getEdgeSet(); for (Edge edge : edges) { Node other = edge.getOpposite(node); if (edge.hasAttribute(weightAttributeName)) weight = edge.getNumber(weightAttributeName); targets.put(other.getId(), new TargetPath(other, weight, null)); } }
if (e.hasAttribute(weightMarker)) if (e.isDirected()) { Edge e2 = v.getEdgeToward(u.getId()); if (e2 != null && e2.hasAttribute(weightMarker)) weight = (Double) e.getAttribute(weightMarker) + (Double) e2.getAttribute(weightMarker);
if (e.hasAttribute(weightMarker)) if (e.isDirected()) { Edge e2 = v.getEdgeToward(u.getId()); if (e2 != null && e2.hasAttribute(weightMarker)) weight = (Double) e.getAttribute(weightMarker) + (Double) e2.getAttribute(weightMarker);
groups.addElement(e); if (e.hasAttribute("ui.style")) stylesheet.parseStyleFromString( new Selector(Type.EDGE, e.getId(), null),
groups.addElement(e); if (e.hasAttribute("ui.style")) stylesheet.parseStyleFromString( new Selector(Type.EDGE, e.getId(), null),