Manually add a static route between two nodes.

@param nm    a node mapping containing two nodes: the source and the destination node.
@param links an insert-ordered map of link<->direction representing the path between the two nodes.
974982
public void setStaticRoute(NodesMap nm, Map<Link, Boolean> links) {
        routes.put(nm, links); // Only one route between two nodes (replace the old route)
    }
1374264
protected static List<Point> getNodePath (Node n)
    {
        Node cur = n;
        ArrayList<Point> path = Lists.newArrayList();

        while (cur != null) {
            // add to the head of the list since we're traversing from
            // the end to the beginning
            path.add(0, new Point(cur.x, cur.y));

            // advance to the next node in the path
            cur = cur.parent;
        }

        return path;
    }
949148
public void setSymbolicLinks(java.util.Collection<SymbolicLink> symbolicLinks) {
        if (symbolicLinks == null) {
            this.symbolicLinks = null;
            return;
        }

        this.symbolicLinks = new java.util.ArrayList<SymbolicLink>(symbolicLinks);
    }
1081253
void connectTo(final Node<T> o) {
    if (!this.graph.equals(o.graph))
      throw new IllegalArgumentException("Cannot connect to nodes of two different graphs.");
    if (this.equals(o)) {
      return;
    }
    neighbours.add(o);
  }
1011929
@SuppressWarnings("unchecked")
	public T add(Link link) {

		Assert.notNull(link, "Link must not be null!");

		this.links.add(link);

		return (T) this;
	}
534834
public void connectIfNotConnectedInDirection(N srcValue, E edgeValue, N destValue) {
    LinkedDirectedGraphNode<N, E> src = createDirectedGraphNode(srcValue);
    LinkedDirectedGraphNode<N, E> dest = createDirectedGraphNode(destValue);
    if (!this.isConnectedInDirection(src, Predicates.equalTo(edgeValue), dest)) {
      this.connect(src, edgeValue, dest);
    }
  }
624545
static <K, V> void connectExpirables(ReferenceEntry<K, V> previous, ReferenceEntry<K, V> next) {
    previous.setNextExpirable(next);
    next.setPreviousExpirable(previous);
  }
933239
function(route, sourcePoint, targetPoint) {

        var namespace = joint.connectors;
        var connector = this.model.connector();
        var defaultConnector = this.paper.options.defaultConnector;

        if (!connector) {
            connector = defaultConnector || {};
        }

        var connectorFn = joint.util.isFunction(connector) ? connector : namespace[connector.name];
        if (!joint.util.isFunction(connectorFn)) {
            throw new Error('dia.LinkView: unknown connector: "' + connector.name + '".');
        }

        var args = joint.util.clone(connector.args || {});
        args.raw = true; // Request raw g.Path as the result.

        var path = connectorFn.call(
            this, // context
            sourcePoint, // start point
            targetPoint, // end point
            route, // vertices
            args, // options
            this // linkView
        );

        if (typeof path === 'string') {
            // Backwards compatibility for connectors not supporting `raw` option.
            path = new g.Path(V.normalizePathData(path));
        }

        return path;
    }
814760
public Links and(Link... links) {

		Assert.notNull(links, "Links must not be null!");

		return and(Arrays.asList(links));
	}
1096984
public void addLines(Collection<TaintLocation> locations) {
        Objects.requireNonNull(detector, "locations");
        for (TaintLocation location : locations) {
            lines.add(SourceLineAnnotation.fromVisitedInstruction(
                location.getMethodDescriptor(), location.getPosition()));
        }
    }
899463
@Override
  protected RdKNNEntry createNewDirectoryEntry(RdKNNNode node) {
    return new RdKNNDirectoryEntry(node.getPageID(), node.computeMBR(), node.kNNDistance());
  }
605361
function(nodes) {
      var map = {},
          imports = [];

      // Compute a map from name to node.
      nodes.forEach(function(d) {
        map[d.name] = d;
      });

      // For each import, construct a link from the source to target node.
      nodes.forEach(function(d) {
        if (d.imports) d.imports.forEach(function(i) {
          imports.push({source: map[d.name], target: map[i]});
        });
      });

      return imports;
    }
1307942
public void drawLink(Link link) {
        List<Device> linkedDevices = link.getLinkedDevices();
        for (int i = 0; i<linkedDevices.size(); i++) {
            Device from = linkedDevices.get(i);
            for (int j = i+1 ; j<linkedDevices.size(); j++) {
                Device to = linkedDevices.get(j);
                Edge e = new Edge(from, to, link);
                links.addEdge(e);
            }
        }
    }
411697
function addRoutes(routes) {
        if (isReactChildren(routes)) routes = createRoutesFromReactChildren(routes);

        addRoutesToNamedRoutes(routes, Router.namedRoutes);

        Router.routes.push.apply(Router.routes, routes);
      }
296905
async def create_link(project, nodes):
    
    node1 = random.choice(list(nodes.values()))

    for port in range(0, 8):
        node2 = random.choice(list(nodes.values()))

        if node1 == node2:
            continue

        data = {"nodes":
                [
                    {
                        "adapter_number": 0,
                        "node_id": node1["node_id"],
                        "port_number": port
                    },
                    {
                        "adapter_number": 0,
                        "node_id": node2["node_id"],
                        "port_number": port
                    }
                ]
                }
        try:
            await post("/projects/{}/links".format(project["project_id"]), body=data)
        except (HTTPConflict, HTTPNotFound):
            pass
192291
public static void initialiseLinks(TraceCompletionInformation ci, long fragmentBaseTime, Node n,
            StringBuilder nodeId) {
        // Add Communication to represent a potential 'CausedBy' link from one or more fragments back to
        // this node
        TraceCompletionInformation.Communication c = new TraceCompletionInformation.Communication();

        c.getIds().add(nodeId.toString());

        // Define a a multi-consumer as potentially multiple CausedBy correlations may be created
        // back to this node
        c.setMultipleConsumers(true);

        // Calculate the base duration for the communication
        c.setBaseDuration(n.getTimestamp() - fragmentBaseTime);

        c.setExpire(System.currentTimeMillis()+
                TraceCompletionInformation.Communication.DEFAULT_EXPIRY_WINDOW_MILLIS);

        if (log.isLoggable(Level.FINEST)) {
            log.finest("Adding communication to completion information: ci=" + ci + " comms=" + c);
        }

        ci.getCommunications().add(c);

        if (n.getClass() == Producer.class) {
            // Get correlation ids
            List<CorrelationIdentifier> cids = n.findCorrelationIds(Scope.Interaction, Scope.ControlFlow);

            if (!cids.isEmpty()) {
                c = new TraceCompletionInformation.Communication();

                for (int i = 0; i < cids.size(); i++) {
                    c.getIds().add(cids.get(i).getValue());
                }

                c.setMultipleConsumers(((Producer) n).multipleConsumers());

                // Calculate the base duration for the communication
                c.setBaseDuration(n.getTimestamp() - fragmentBaseTime);

                c.setExpire(System.currentTimeMillis() +
                        TraceCompletionInformation.Communication.DEFAULT_EXPIRY_WINDOW_MILLIS);

                if (log.isLoggable(Level.FINEST)) {
                    log.finest("Adding communication to completion information: ci=" + ci + " comms=" + c);
                }

                ci.getCommunications().add(c);
            }
        } else if (n.containerNode()) {
            ContainerNode cn = (ContainerNode) n;
            for (int i = 0; i < cn.getNodes().size(); i++) {
                int len = nodeId.length();
                nodeId.append(':');
                nodeId.append(i);
                initialiseLinks(ci, fragmentBaseTime, cn.getNodes().get(i), nodeId);

                // Remove this child's specific path, so that next iteration will add a different path number
                nodeId.delete(len, nodeId.length());
            }
        }
    }
1341685
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
	public final boolean addRoadPolyline(RoadPolyline segment) throws RoadNetworkException {
		// Check element validity
		assert segment != null;
		final RoadNetwork currentNetwork = segment.getRoadNetwork();
		if (currentNetwork == this) {
			return false;
		}
		if (currentNetwork != null) {
			throw new RoadNetworkException("segment is already in a road network"); //$NON-NLS-1$;
		}
		if (segment.getPointCount() <= 1) {
			throw new RoadNetworkException("segment has not two points"); //$NON-NLS-1$;
		}

		// Get segment information
		StandardRoadConnection startConnection = null;
		StandardRoadConnection endConnection = null;
		final Point2d firstPoint;
		final Point2d lastPoint;
		try {
			firstPoint = segment.getFirstPoint();
			if (firstPoint == null) {
				throw new RoadNetworkException("segment has not a first point"); //$NON-NLS-1$
			}
		} catch (IndexOutOfBoundsException exception) {
			throw new RoadNetworkException("segment has not a first point"); //$NON-NLS-1$
		}
		try {
			lastPoint = segment.getLastPoint();
			if (lastPoint == null) {
				throw new RoadNetworkException("segment has not a last point"); //$NON-NLS-1$
			}
		} catch (IndexOutOfBoundsException exception) {
			throw new RoadNetworkException("segment has not a last point"); //$NON-NLS-1$
		}

		final OutputParameter<RoadPolyline> firstNeighbour = new OutputParameter<>();
		final OutputParameter<RoadPolyline> secondNeighbour = new OutputParameter<>();

		if (this.roadSegments.add(
				segment,
				RoadNetworkConstants.getPreferredRoadConnectionDistance(),
				firstNeighbour, secondNeighbour)) {
			RoadPolyline seg = firstNeighbour.get();
			if (seg != null) {
				startConnection = seg.getNearestPoint(StandardRoadConnection.class, firstPoint.getX(), firstPoint.getY());
			}
			seg = secondNeighbour.get();
			if (seg != null) {
				endConnection = seg.getNearestPoint(StandardRoadConnection.class, lastPoint.getX(), lastPoint.getY());
			}

			int nbNewConn = 0;

			if (startConnection == null && endConnection == null
					&& firstPoint.epsilonEquals(lastPoint, MapElementConstants.POINT_FUSION_DISTANCE)) {
				startConnection = new StandardRoadConnection();
				endConnection = startConnection;
				nbNewConn += 2;
			}
			if (startConnection == null) {
				startConnection = new StandardRoadConnection();
				++nbNewConn;
			}
			if (endConnection == null) {
				endConnection = new StandardRoadConnection();
				++nbNewConn;
			}

			try {
				segment.setRoadNetwork(this);
				segment.setStartPoint(startConnection);
				segment.setEndPoint(endConnection);
				this.connectionCount += nbNewConn;
			} catch (AssertionError e) {
				throw e;
			} catch (Throwable e) {
				this.roadSegments.remove(segment);
				throw new RuntimeException(e);
			}

			Rectangle2d bb = getBoundingBox();
			if (bb == null) {
				bb = segment.getBoundingBox();
			} else {
				bb = bb.createUnion(segment.getBoundingBox());
			}
			setBoundingBox(bb);

			segment.addGISEditableChangeListener(this.eventHandler);

			fireSegmentAdded(segment);

			return true;
		}

		return false;
	}