/** * Correct costs of successors of the input vertex using backward star form. * (FLOWER) * * @param vertex */ public void CorrectCostBackward(BaseVertex vertex) { // 1. initialize the list of vertex to be updated var vertexList = new java.util.LinkedList <BaseVertex>(); vertexList.add(vertex); // 2. update the cost of relevant precedents of the input vertex while (!vertexList.isEmpty()) { BaseVertex curVertex = vertexList.remove(0); double costOfCurVertex = startVertexDistanceIndex[curVertex]; ISet <BaseVertex> preVertexSet = graph.GetPrecedentVertices(curVertex); foreach (BaseVertex preVertex in preVertexSet) { double costOfPreVertex = startVertexDistanceIndex.ContainsKey(preVertex) ? startVertexDistanceIndex[preVertex] : Graph.DISCONNECTED; double freshCost = costOfCurVertex + graph.GetEdgeWeight(preVertex, curVertex); if (costOfPreVertex > freshCost) { startVertexDistanceIndex.AddOrReplace(preVertex, freshCost); predecessorIndex.AddOrReplace(preVertex, curVertex); vertexList.add(preVertex); } } } }
protected internal virtual void createPrimitives(ViewGraphNode root) { LinkedList queue = new LinkedList(); queue.add(root); while (!queue.isEmpty()) { ViewGraphNode act = (ViewGraphNode)queue.remove(0); Shape s = null; if (act.Shape == null) { s = makeShapeFromNode(act, queue); } else { s = act.Shape; } if (act.ParentsChecked) { continue; } act.ParentsChecked = true; for (Iterator it = act.Parents.iterator(); it.hasNext();) { ViewGraphNode n = (ViewGraphNode)it.next(); Shape s1 = n.Shape; if (s1 == null) { s1 = makeShapeFromNode(n, queue); } ConnectorLine line = new ConnectorLine(s1, s); line.Color = System.Drawing.Color.Blue; if (n.ReteNode is BaseJoin) { line.Color = System.Drawing.Color.Red; } addPrimitive(line); } } }
protected internal virtual void createPrimitives(ViewGraphNode root) { LinkedList queue = new LinkedList(); queue.add(root); while (!queue.isEmpty()) { ViewGraphNode act = (ViewGraphNode) queue.remove(0); Shape s = null; if (act.Shape == null) { s = makeShapeFromNode(act, queue); } else { s = act.Shape; } if (act.ParentsChecked) continue; act.ParentsChecked = true; for (Iterator it = act.Parents.iterator(); it.hasNext(); ) { ViewGraphNode n = (ViewGraphNode) it.next(); Shape s1 = n.Shape; if (s1 == null) s1 = makeShapeFromNode(n, queue); ConnectorLine line = new ConnectorLine(s1, s); line.Color = System.Drawing.Color.Blue; if (n.ReteNode is BaseJoin) line.Color = System.Drawing.Color.Red; addPrimitive(line); } } }
/** * Check if it's empty. * @return */ public bool IsEmpty() { return(elementWeightPairList.isEmpty()); }