public void changeLinkWeight(String linkId, double weight) { LabeledLink link = this.getLinkById(linkId); if (link == null) { logger.error("Could not find the link with the id " + linkId); return; } this.graphBuilder.changeLinkWeight(link, weight); }
public boolean addLink(Node source, Node target, DefaultLink link, Double weight) { if (addLink(source, target, link)) { if (weight != null) changeLinkWeight(link, weight); return true; } return false; }
public void changeLinkStatus(LabeledLink link, LinkStatus newStatus) { if (link == null) return; LabeledLink graphLink = this.getIdToLinkMap().get(link.getId()); // use the graph link, not the tree link sent by the alignment (steiner tree has a copy of the graph link) if (graphLink == null) return; LinkStatus oldStatus = graphLink.getStatus(); if (newStatus == oldStatus) return; graphLink.setStatus(newStatus); link.setStatus(newStatus); this.changeLinkWeight(graphLink, computeWeight(graphLink)); Set<LabeledLink> linksWithOldStatus = this.statusToLinksMap.get(oldStatus); if (linksWithOldStatus != null) linksWithOldStatus.remove(graphLink); if (newStatus == LinkStatus.Normal) // we don't need to index normal links return; Set<LabeledLink> linksWithNewStatus = this.statusToLinksMap.get(newStatus); if (linksWithNewStatus == null) { linksWithNewStatus = new HashSet<>(); statusToLinksMap.put(newStatus, linksWithNewStatus); } linksWithNewStatus.add(graphLink); }
public void changeLinkWeight(DefaultLink link, double weight) { super.changeLinkWeight(link, weight); SteinerNode n1 = new SteinerNode(link.getSource().getId()); SteinerNode n2 = new SteinerNode(link.getTarget().getId()); SteinerEdge e = new SteinerEdge(n1, link.getId(), n2, (float)weight); if (getTopKGraph().get(n2).remove(e)) { if (link instanceof LabeledLink) { e.setModelIds(((LabeledLink)link).getModelIds()); e.setForced(((LabeledLink)link).getStatus() == LinkStatus.ForcedByUser); } getTopKGraph().get(n2).add(e); } }
double newW = model.getGraph().getEdgeWeight(e); if (newW < currentW) this.graphBuilder.changeLinkWeight(l, newW); } else if (weightSystem == PatternWeightSystem.JWSPaperFormula) { if (n2 instanceof InternalNode) { this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT - ((double) (numOfPatterns + 1) / (double) (this.totalNumberOfKnownModels + 1) )); this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT); this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT);
LabeledLink l = this.graphBuilder.getIdToLinkMap().get(id); if (l != null) { this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT); l.getModelIds().add(modelId); n1.getModelIds().add(modelId);
double newW = model.getGraph().getEdgeWeight(e); if (newW < currentW) this.graphBuilder.changeLinkWeight(l, newW); } else if (weightSystem == PatternWeightSystem.JWSPaperFormula) { if (n2 instanceof InternalNode) { this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT - ((double) (numOfPatterns + 1) / (double) (this.totalNumberOfKnownModels + 1) )); this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT); this.graphBuilder.changeLinkWeight(l, ModelingParams.PATTERN_LINK_WEIGHT);
Integer count = this.graphBuilder.getLinkCountMap().get(key); if (count != null) this.graphBuilder.changeLinkWeight(link, ModelingParams.PATTERN_LINK_WEIGHT - ((double)count / (double)this.graphBuilder.getNumberOfModelLinks()) ); newLink = newLinks.get(i); this.graphBuilder.addLink(sources.get(i), targets.get(i), newLink); this.graphBuilder.changeLinkWeight(newLink, weights.get(i));
this.graphBuilder.changeLinkWeight(link, ModelingParams.PATTERN_LINK_WEIGHT);