Adds the edge to this set if one of the vertices is the root vertex.

@return {@code true} if e was added or if the weight was changed for the
conenction between an existing edge that matched
196767
public boolean add(WeightedEdge e) {
        int toAdd = -1;
        if (e.from() == rootVertex) 
            toAdd = e.to();        
        else if (e.to() == rootVertex)
            toAdd = e.from();
        else {
            return false;
        }
        
        double w = e.weight();
        if (edges.containsKey(toAdd)) {
            double w2 = edges.put(toAdd, w);
            // The weight was changed but a new edge was not added
            return false;
        }
        else {
            edges.put(toAdd, w);
            return true;
        }
    }
1103684
boolean addNextRow( SquareNode seed , List<List<SquareNode>> grid ) {
		List<SquareNode> row = new ArrayList<>();
		List<SquareNode> tmp = new ArrayList<>();

		int numConnections = numberOfOpenEdges(seed);
		if( numConnections == 0 ) {
			return false;
		} else if( numConnections == 1 ) {
			for (int i = 0; i < seed.square.size(); i++) {
				SquareEdge edge = seed.edges[i];
				if( edge != null ) {
					// see if the edge is one of the open ones
					SquareNode dst = edge.destination(seed);
					if( dst.graph != SquareNode.RESET_GRAPH)
						continue;

					// determine which direction to traverse along
					int corner = edge.destinationSide(seed);
					int l = addOffset(corner,-1,dst.square.size());
					int u = addOffset(corner, 1,dst.square.size());

					// Nodes in the seed's row should all be marked, so any unmarked nodes
					// are ones you don't want to traverse down
					if( isClosedValidEdge(dst,l) ) {
						if( !addToRow(seed,i, 1,false,tmp) ) return false;
						flipAdd(tmp, row);
					} else if( isClosedValidEdge(dst,u) ){
						if( !addToRow(seed,i, -1,false,row) ) return false;
					} else {
						dst.graph = 0;
						row.add(dst);
					}
					break;
				}
			}
		} else if( numConnections == 2 ) {
			int indexLower = lowerEdgeIndex(seed);
			int indexUpper = addOffset(indexLower,1,seed.square.size());

			if( !addToRow(seed,indexUpper, 1,false,tmp) ) return false;
			flipAdd(tmp, row);
			if( !addToRow(seed,indexLower,-1,false,row) ) return false;
		} else {
			return false;
		}
		grid.add(row);
		return true;
	}
1065909
def add_self_edges(self, weight=None, copy=False):
    ''''''
    ii = np.arange(self.num_vertices())
    return self.add_edges(ii, ii, weight=weight, symmetric=False, copy=copy)
21513
public void add(Vertex vtx) {
        if (head == null) {
            head = vtx;
        } else {
            tail.next = vtx;
        }
        vtx.prev = tail;
        vtx.next = null;
        tail = vtx;
    }
1338532
private boolean isSegment(SNode currNode) {

    List<SRelation<SNode, SNode>> edges = currNode.getGraph().getOutRelations(currNode.getId());

    if (edges != null && edges.size() > 0) {
      for (SRelation<SNode, SNode> edge : edges) {
        if (edge.getTarget() instanceof SToken) {
          return true;
        }
      }
    }

    return false;
  }
417289
def add_edge(self, u, v, **attr):
        
        if u not in self.vertices:
            self.vertices[u] = []
            self.pred[u] = []
            self.succ[u] = []
        if v not in self.vertices:
            self.vertices[v] = []
            self.pred[v] = []
            self.succ[v] = []
        vertex = (u, v)
        self.edges[vertex] = {}
        self.edges[vertex].update(attr)
        self.vertices[u].append(v)
        self.pred[v].append(u)
        self.succ[u].append(v)
712070
function(nodeobj){
		// 一度Edgeを取り外す
		if(this.getObjNodeList(nodeobj).length>0){
			this.removeEdgeByNodeObj(nodeobj);
		}
		
		// Edgeを付け直す
		if(this.calcNodeCount(nodeobj)>0){
			this.addEdgeByNodeObj(nodeobj);
		}
	}
193179
public void addEdge(int from, int to) {
        Set<Integer> outEdges = edges.get(from);
        if (outEdges == null) {
            outEdges = new TreeSet<Integer>();
            edges.put(from, outEdges);
        }
        outEdges.add(to);
    }
439204
public void add(E edge) {
        if (! edge.added) { 
            edges.add(edge);
            edge.added = true;
            add(edge.getChild());
            add(edge.getParent());
        }
    }
1337830
private void addEdge(int i, int j) {
		if(!nodes.contains(i)){
			nodes.add(i);
			edges.put(i, new HashSet<Integer>());
			size++;
		}else if(!edges.containsKey(i)){
			edges.put(i, new HashSet<Integer>());
		}

		if(!nodes.contains(j)){
			nodes.add(j);
			size++;
		}
		edgesInv.put(j, i);

		if(!edges.get(i).contains(j)){
			edges.get(i).add(j);
		}

	}
356344
public boolean addChild(ClusteringTreeNode e) {
		assert (this.center.length == e.center.length);
		return this.children.add(e);
	}
193183
def addEdge(self, outVertex, inVertex, label):
        """"""
        n1 = outVertex.neoelement
        n2 = inVertex.neoelement
        edge = n1.relationships.create(label, n2)
        return Edge(edge)
539909
def add_edge(self, edge):
        
        u, v = edge

        both_exist = u in self.vertices and v in self.vertices
        # Using `is` because if they belong to the same component, they MUST
        # share the same set object!
        if both_exist and self.components[u] is self.components[v]:
            # Both vertices are part of the same connected component.
            raise InvariantError('Adding %r would form a cycle' % (edge,))
        if u == v:
            raise InvariantError('Cannot add loop: %r' % (edge,))

        # Ensure the vertices exist in the graph.
        self.add_vertex(u)
        self.add_vertex(v)

        # Add the edges to each other.
        self._vertices[u].add(v)
        self._vertices[v].add(u)

        # Add all of the smaller components to the bigger one.
        smaller_component, bigger_component = self.sort_components(u, v)
        for vertex in smaller_component:
            bigger_component.add(vertex)
            # And with this assignment, say bye-bye to the smaller component.
            self.components[vertex] = bigger_component
668827
@Override
    public void removeEdge(Edge edge) {
        super.removeEdge(edge);

        // Keep track of removed edges.
        if (removedEdgeList == null) {
            removedEdgeList = new LinkedList<>();
        }
        removedEdgeList.add(edge);
    }
180078
private void add(final PathEdge edge) {
        int u = edge.either();
        int v = edge.other(u);
        if (rank[u] < rank[v])
            graph[u].add(edge);
        else
            graph[v].add(edge);
    }
1221222
def add_edge(*vertices, **kvargs)
      edge = new_edge(*vertices, mixins: @mixins, **kvargs)
      insert_edge(edge)
      vertices.each { |vertex| callback(vertex, :edge_added, edge) }
      edge
    end
52953
protected final Vertex addIntent(final E proposed, Vertex generator) {
        generator = supremum(proposed, generator);

        if (filter(generator, proposed) && filter(proposed, generator)) {
            return generator;
        }
        
        List parents = new ArrayList<>();
        for (Edge edge : generator.getEdges(Direction.BOTH)) {
            Vertex target = edge.getVertex(Direction.OUT);
            if (filter(target, generator)) {
                continue;
            }

            Vertex candidate = target;
            if (!filter(target, proposed) && !filter(proposed, target)) {
                E targetElement = target.getProperty(LABEL);
                E intersect = (E) targetElement.intersect(proposed);
                candidate = addIntent(intersect, candidate);
            }

            boolean add = true;
            List doomed = new ArrayList<>();
            for (java.util.Iterator it = parents.iterator(); it.hasNext();) {
                Vertex parent = (Vertex) it.next();

                if (filter(parent, candidate)) {
                    add = false;
                    break;
                }
                else if (filter(candidate, parent)) {
                    doomed.add(parent);
                }
            }

            for (java.util.Iterator it = doomed.iterator(); it.hasNext();) {
                Vertex vertex = (Vertex) it.next();
                parents.remove(vertex);
            }

            if (add) {
                parents.add(candidate);
            }
        }

        E generatorLabel = generator.getProperty(LABEL);

        Vertex child = insert((E) proposed.union(generatorLabel));
        addUndirectedEdge(generator, child, ""); 
        
        bottom = filter(bottom, proposed) ? child : bottom;

        for (java.util.Iterator it = parents.iterator(); it.hasNext();) {
            Vertex parent = (Vertex) it.next();
            if (!parent.equals(generator)) {
                removeUndirectedEdge(parent, generator);
                addUndirectedEdge(parent, child, "");
            }
        }
        return child;
    }