Adds startVertex to the output exits startVertex using a given edge: walkIri, and recurse on the result
179899
function walkmap(g, iri, walkIri, s = new Set()) {
  if (s.has(iri)) return s; // Prevents cycles
  if (!g[iri]) return warn(`Resource missing in graph: ${iri}`) || s;

  s.add(iri);

  if (g[iri][walkIri]) g[iri][walkIri].forEach(wIri => walkmap(g, wIri, walkIri, s));

  return s;
}
973005
Collection<EdgeIteratorState> addBarrierEdge(long fromId, long toId, IntsRef inEdgeFlags, long nodeFlags, long wayOsmId) {
        IntsRef edgeFlags = IntsRef.deepCopyOf(inEdgeFlags);
        // clear blocked directions from flags
        for (BooleanEncodedValue accessEnc : encodingManager.getAccessEncFromNodeFlags(nodeFlags)) {
            accessEnc.setBool(false, edgeFlags, false);
            accessEnc.setBool(true, edgeFlags, false);
        }
        // add edge
        barrierNodeIds.clear();
        barrierNodeIds.add(fromId);
        barrierNodeIds.add(toId);
        return addOSMWay(barrierNodeIds, edgeFlags, wayOsmId);
    }
69054
public void gotoNextBlockStart(int index, int xor) { // goto block start pos
        if (xor < (1 << 10)) { // level = 1
            display0 = (Object[]) display1[(index >> 5) & 31];
        } else if (xor < (1 << 15)) { // level = 2
            display1 = (Object[]) display2[(index >> 10) & 31];
            display0 = (Object[]) display1[0];
        } else if (xor < (1 << 20)) { // level = 3
            display2 = (Object[]) display3[(index >> 15) & 31];
            display1 = (Object[]) display2[0];
            display0 = (Object[]) display1[0];
        } else if (xor < (1 << 25)) { // level = 4
            display3 = (Object[]) display4[(index >> 20) & 31];
            display2 = (Object[]) display3[0];
            display1 = (Object[]) display2[0];
            display0 = (Object[]) display1[0];
        } else if (xor < (1 << 30)) { // level = 5
            display4 = (Object[]) display5[(index >> 25) & 31];
            display3 = (Object[]) display4[0];
            display2 = (Object[]) display3[0];
            display1 = (Object[]) display2[0];
            display0 = (Object[]) display1[0];
        } else { // level = 6
            throw new IllegalArgumentException();
        }
    }
84449
function walklook(g, iri, walkIri, lookIri, s = new Set(), ws = new Set()) {
  if (ws.has(iri)) return s; // Prevents cycles
  if (!g[iri]) return warn(`Resource missing in graph: ${iri}`) || s;

  ws.add(iri);

  if (g[iri][lookIri]) g[iri][lookIri].forEach(lIri => s.add(lIri));

  if (s.size) return s;

  if (g[iri][walkIri]) g[iri][walkIri].forEach(wIri => walklook(g, wIri, walkIri, lookIri, s, ws));

  return s;
}
7533
def start_output (self):
        """"""
        super(DOTLogger, self).start_output()
        if self.has_part("intro"):
            self.write_intro()
            self.writeln()
        self.writeln(u"digraph G {")
        self.writeln(u"  graph [")
        self.writeln(u"    charset=\"%s\"," % self.get_charset_encoding())
        self.writeln(u"  ];")
        self.flush()
163280
def connect(self, source, target, witnesses):
        
        # print("Adding Edge: "+source+":"+target)
        if self.graph.has_edge(source, target):
            self.graph[source][target]["label"] += ", " + str(witnesses)
        else:
            self.graph.add_edge(source, target, label=witnesses)
59101
function startLine (e) {
            e.preventDefault();

            strokes = that.strokes;
            sketching = true;
            that.undos = [];

            var cursor = getCursorRelativeToCanvas(e);
            strokes.push({
                points: [cursor],
                color: opts.line.color,
                size: getLineSizeRelativeToCanvas(opts.line.size),
                cap: opts.line.cap,
                join: opts.line.join,
                miterLimit: opts.line.miterLimit
            });
        }
826470
private void convertToOutput(List<ChessboardCorner> corners) {

		c2n.resize(corners.size());
		n2c.resize(vertexes.size());
		open.reset();
		n2c.fill(-1);
		c2n.fill(-1);

		for (int seedIdx = 0; seedIdx < vertexes.size; seedIdx++) {
			Vertex seedN = vertexes.get(seedIdx);
			if( seedN.marked)
				continue;
			ChessboardCornerGraph graph = clusters.grow();
			graph.reset();

			// traverse the graph and add all the nodes in this cluster
			growCluster(corners, seedIdx, graph);

			// Connect the nodes together in the output graph
			for (int i = 0; i < graph.corners.size; i++) {
				ChessboardCornerGraph.Node gn = graph.corners.get(i);
				Vertex n = vertexes.get( n2c.get(i) );

				for (int j = 0; j < n.connections.size(); j++) {
					int edgeCornerIdx = n.connections.get(j).dst.index;
					int outputIdx = c2n.get( edgeCornerIdx );
					if( outputIdx == -1 ) {
						throw new IllegalArgumentException("Edge to node not in the graph. n.idx="+n.index+" conn.idx="+edgeCornerIdx);
					}
					gn.edges[j] = graph.corners.get(outputIdx);
				}
			}

			// ensure arrays are all -1 again for sanity checks
			for (int i = 0; i < graph.corners.size; i++) {
				ChessboardCornerGraph.Node gn = graph.corners.get(i);
				int indexCorner = n2c.get(gn.index);
				c2n.data[indexCorner] = -1;
				n2c.data[gn.index] = -1;
			}

			if( graph.corners.size <= 1 )
				clusters.removeTail();
		}
	}
607388
def run(self, format=None, reduce=False, *args, **kwargs):
        
        plan = self._generate_plan()
        if reduce:
            # This will performa a transitive reduction on the underlying
            # graph, producing less edges. Mostly useful for the "dot" format,
            # when converting to PNG, so it creates a prettier/cleaner
            # dependency graph.
            plan.graph.transitive_reduction()

        fn = FORMATTERS[format]
        fn(sys.stdout, plan.graph)
        sys.stdout.flush()
1292330
def add_edge(self, graph_edge):
        

        if not isinstance(graph_edge, Edge):
            raise TypeError('add_edge() received a non edge class object: ' + str(graph_edge))

        edge_points = ( graph_edge.get_source(), graph_edge.get_destination() )

        if self.obj_dict['edges'].has_key(edge_points):

            edge_list = self.obj_dict['edges'][edge_points]
            edge_list.append(graph_edge.obj_dict)

        else:

            self.obj_dict['edges'][edge_points] = [ graph_edge.obj_dict ]


        graph_edge.set_sequence( self.get_next_sequence_number() )

        graph_edge.set_parent_graph( self.get_parent_graph() )
589269
public void process(GrayF32 intensity, QueueCorner corners ) {
		corners.reset();

		float data[] = intensity.data;

		for( int y = 0; y < intensity.height; y++ ) {
			int startIndex = intensity.startIndex + y*intensity.stride;
			int endIndex = startIndex + intensity.width;

			for( int index = startIndex; index < endIndex; index++ ) {
				if( data[index] > thresh ) {
					int x = index-startIndex;
					corners.add(x,y);
				}
			}
		}
	}
1119954
protected void _beforeNewSegment(int resizeBy) {
		// Called for each new segment being added.
		if (m_bPathStarted) {
			_initPathStartPoint();// make sure the m_movetoPoint exists and has
									// right vertex description

			// The new path is started. Need to grow m_parts and m_pathFlags.
			if (m_paths == null) {
				m_paths = (AttributeStreamOfInt32) AttributeStreamBase
						.createIndexStream(2);
				m_paths.write(0, 0);
				m_pathFlags = (AttributeStreamOfInt8) AttributeStreamBase
						.createByteStream(2, (byte) 0);
			} else {
				// _ASSERT(m_parts.size() >= 2);
				m_paths.resize(m_paths.size() + 1, 0);
				m_pathFlags.resize(m_pathFlags.size() + 1, 0);
			}

			if (m_bPolygon) {
				// Mark the path as closed
				m_pathFlags.write(m_pathFlags.size() - 2,
						(byte) PathFlags.enumClosed);
			}

			resizeBy++; // +1 for the StartPath point.
		}

		int oldcount = m_pointCount;
		m_paths.write(m_paths.size() - 1, m_pointCount + resizeBy); // The
																	// NotifyModified
																	// will
																	// update
																	// the
																	// m_pointCount
																	// with this
																	// value.
		_resizeImpl(oldcount + resizeBy);
		m_pathFlags.write(m_paths.size() - 1, (byte) 0);

		if (m_bPathStarted) {
			setPointByVal(oldcount, m_moveToPoint);// setPoint(oldcount,
													// m_moveToPoint); //finally
													// set the start point to
													// the geometry
			m_bPathStarted = false;
		}
	}
551343
def add_line(self, start, end, color=(0.5, 0.5, 0.5), width=1):
        
        source = vtk.vtkLineSource()
        source.SetPoint1(start)
        source.SetPoint2(end)

        vertexIDs = vtk.vtkStringArray()
        vertexIDs.SetNumberOfComponents(1)
        vertexIDs.SetName("VertexIDs")
        # Set the vertex labels
        vertexIDs.InsertNextValue("a")
        vertexIDs.InsertNextValue("b")
        source.GetOutput().GetPointData().AddArray(vertexIDs)

        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputConnection(source.GetOutputPort())
        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        actor.GetProperty().SetColor(color)
        actor.GetProperty().SetLineWidth(width)
        self.ren.AddActor(actor)
504258
protected void connectInner(GrayS32 input, GrayS32 output) {

		int startX = connectRule == ConnectRule.EIGHT ? 1 : 0;

		for( int y = 0; y < input.height-1; y++ ) {
			int indexIn = input.startIndex + y*input.stride + startX;
			int indexOut = output.startIndex + y*output.stride + startX;

			for( int x = startX; x < input.width-1; x++ , indexIn++, indexOut++) {
				int inputLabel = input.data[indexIn];
				int outputLabel = output.data[indexOut];
				if( outputLabel == -1 ) { // see if it needs to create a new output segment
					output.data[indexOut] = outputLabel = regionMemberCount.size;
					regionMemberCount.add(1);
					mergeList.add(outputLabel);
				}

				for( int i = 0; i < edgesIn.length; i++ ) {
					if( inputLabel == input.data[indexIn+edgesIn[i]] ) {
						int outputAdj = output.data[indexOut+edgesOut[i]];
						if( outputAdj == -1 ) {  // see if not assigned
							regionMemberCount.data[outputLabel]++;
							output.data[indexOut+edgesOut[i]] = outputLabel;
						} else if( outputLabel != outputAdj ) { // see if assigned to different regions
							markMerge(outputLabel,outputAdj);
						} // do nothing, same input and output labels
					}
				}
			}
		}
	}
695404
def add_edges(self, edges, *args, **kwargs):
        
        for edge in edges:
            self.add_edge(edge, *args, **kwargs)
1295601
def _connect_begin_to(self, shape, cxn_pt_idx):
        
        cNvCxnSpPr = self._element.nvCxnSpPr.cNvCxnSpPr
        stCxn = cNvCxnSpPr.get_or_add_stCxn()
        stCxn.id = shape.shape_id
        stCxn.idx = cxn_pt_idx
1330734
def _make_return_edges(self):
        

        for func_addr, func in self.functions.items():
            if func.returning is False:
                continue

            # get the node on CFG
            if func.startpoint is None:
                l.warning('Function %#x does not have a startpoint (yet).', func_addr)
                continue

            startpoint = self.model.get_any_node(func.startpoint.addr)
            if startpoint is None:
                # weird...
                l.warning('No CFGNode is found for function %#x in _make_return_edges().', func_addr)
                continue

            endpoints = self._get_return_sources(func)

            # get all callers
            callers = self.model.get_predecessors(startpoint, jumpkind='Ijk_Call')
            # for each caller, since they all end with a call instruction, get the immediate successor
            return_targets = itertools.chain.from_iterable(
                self.model.get_successors(caller, excluding_fakeret=False, jumpkind='Ijk_FakeRet') for caller in callers
            )
            return_targets = set(return_targets)

            for ep in endpoints:
                src = self.model.get_any_node(ep.addr)
                for rt in return_targets:
                    if not src.instruction_addrs:
                        ins_addr = None
                    else:
                        if self.project.arch.branch_delay_slot:
                            if len(src.instruction_addrs) > 1:
                                ins_addr = src.instruction_addrs[-2]
                            else:
                                l.error('At %s: expecting more than one instruction. Only got one.', src)
                                ins_addr = None
                        else:
                            ins_addr = src.instruction_addrs[-1]

                    self._graph_add_edge(rt, src, 'Ijk_Ret', ins_addr, DEFAULT_STATEMENT)