include an object graph in another
8879
function(target, namespace, graph) {
      
      //if the first param is a string, 
      //we are including the namespace on Sysmo
      if (typeof target == 'string') {
        graph = namespace;
        namespace = target;
        target = Sysmo;
      }
      
      //create namespace on target
      Sysmo.namespace(namespace, target);
      //get inner most object in namespace
      target = Sysmo.getDeepValue(target, namespace);
      //merge graph on inner most object in namespace
      return Sysmo.extend(target, graph);
      
    }
861421
function includesAtSteal(graph) {
	var found = false;

	var isAtSteal = function(name) {
		return name === "@steal";
	};

	keys(graph).forEach(function(name) {
		var node = graph[name];

		if (isPluginExcludedFromBuild(node)) {
			return;
		}

		if (isAtSteal(name)) {
			return (found = true);
		}

		defaultTo(node.dependencies, []).forEach(function(depName) {
			if (isAtSteal(depName)) {
				return (found = true);
			}
		});
	});

	return found;
}
444035
def add_graph(self, other):
        
        self.add_nodes( n for n in other.nodes() if not n in self.nodes() )
        
        for each_node in other.nodes():
            for each_edge in other.neighbors(each_node):
                if (not self.has_edge((each_node, each_edge))):
                    self.add_edge((each_node, each_edge))
707088
def _make_graph(self, max_insert):
        ''''''
        if len(self.partial_links) != 0:
            raise Error('Error in _make_graph(). Cannot continue because there are partial links')
        
        self.contig_links = {}
        for key in self.links:
            for l in self.links[key]:
                insert_size = l.insert_size()
                if insert_size <= max_insert:
                    if key not in self.contig_links:
                        self.contig_links[key] = {}
                    dirs = ''.join(l.dirs)
                    self.contig_links[key][dirs] = self.contig_links[key].get(dirs, 0) + 1
956527
def graph(self, name, *args, **kwargs):
        
        return Graph(self, name, *args, **kwargs)
1028715
function(obj) { 
   if(!this.nodes[obj.id]) {  
     var edges = this.edges[obj.id] = {};
     this.nodes[obj.id] = new Graph.Node($.extend({
        'id': obj.id,
        'name': obj.name,
        'data': obj.data || {},
        'adjacencies': edges 
      }, this.opt.Node), 
      this.opt.complex, 
      this.Node, 
      this.Edge,
      this.Label);
    }
    return this.nodes[obj.id];
  }
72649
def _add_chart_graphicFrame(self, rId, x, y, cx, cy):
        
        shape_id = self._next_shape_id
        name = 'Chart %d' % (shape_id-1)
        graphicFrame = CT_GraphicalObjectFrame.new_chart_graphicFrame(
            shape_id, name, rId, x, y, cx, cy
        )
        self._spTree.append(graphicFrame)
        return graphicFrame
12035
function(other, t) {
            var newpos = this.pos.lerp(other.pos, t);
            return new CSG.Vertex(newpos);
        }
1151975
function initVivaGraph(){
    g = Viva.Graph.graph();
    isPaused = false;

    divGraph = document.getElementById('divGraph');

    $('#divGraph').append("<div id='loadingText' class='hero-body has-text-centered'><h1 class='title'>Loading...</h1></div>");

    console.time("nodesFromMWG");
    graph.indexes(WORLD, TIME, function (indexNames) {
        var defer = graph.newCounter(indexNames.length);
        for (var i = 0; i < indexNames.length; ++i) {
            const indexName = indexNames[i];
            /*graph.getIndexNode(WORLD, TIME, indexName, function (node) {
             console.log(node.toString());
             });*/
            graph.findAll(WORLD, TIME, indexName, function (nodes) {
                // transform every mwg nodes and add them to a global array
                for (var j = 0; j < nodes.length; ++j){
                    addToGlobalNodes(nodes[j]);
                }
                defer.count();
            });
        }

        defer.then(function() {
            console.timeEnd("nodesFromMWG");
            console.time("nodesToVivagraph");
            // add only 'nbNodesToDisplay' nodes to the graph
            var nbNodesToDisplay = (gAllNodes.length > NB_NODES_TO_DISPLAY ? NB_NODES_TO_DISPLAY : gAllNodes.length);
            for (var i = 0; i < nbNodesToDisplay; ++i){
                addNodeToGraph(gAllNodes[i]);
            }
            for (var i = 0; i < gNodesWithRel.length; ++i){
                addRelToGraph(gNodesWithRel[i]);
            }
            gRootNodes = _.difference(gAllNodes, gChildrenNodes);
            createTree();
            var maxChildNodes = getMaxChildNodes();
            console.timeEnd("nodesToVivagraph");

            console.time("rendering+loading");
            graphics = Viva.Graph.View.webglGraphics();
            graphics
                .node(function(node){
                    return Viva.Graph.View.webglSquare(NODE_SIZE, colorsByNodeType[node.data._type]);
                })
                .link(function(link) {
                    return Viva.Graph.View.webglLine(colorsByLinkType[link.data]);
                });

            var events = Viva.Graph.webglInputEvents(graphics, g);

            events.mouseEnter(function (vivagraphNode) {
                /*var nodeUI = graphics.getNodeUI(vivagraphNode.id);
                 nodeUI.color = '0x00BFFFFF';
                 renderer.rerender();*/
            }).mouseLeave(function (vivagraphNode) {
                /* var nodeUI = graphics.getNodeUI(vivagraphNode.id);
                 nodeUI.color = hexColorToWebGLColor(colorsByNodeType[vivagraphNode.data._type]);
                 renderer.rerender();*/
            }).dblClick(function (vivagraphNode) {
                drawNodeContext(vivagraphNode.data._id, NB_HOPS);
            }).click(function (vivagraphNode) {
                highlightNodeWebGL(vivagraphNode.data);
                displayNameDOM(vivagraphNode.data);
                globalFunc.setNodeDetailOnClick(vivagraphNode.data);
            });

            //TODO : slow things really badly
            /*
             graphics.placeNode(function(ui, pos){
             var label = $('.nodeLabel');
             if (label.length){
             var nodePos = layout.getNodePosition(label.attr('id'));
             var domPos = {
             x: nodePos.x,
             y: nodePos.y
             };

             graphics.transformGraphToClientCoordinates(domPos);
             label.css({'left' : domPos.x, 'top' : domPos.y});

             //hide label if it goes out of the divGraph layout
             if (domPos.x < 0 || domPos.y < 0) {
             label.hide();
             } else {
             label.show();
             }
             }
             });
             */

            console.time("loading data in components");
            // Load the necessary stuff (nodes) in the react components
            globalFunc.addNodesInList();
            globalFunc.setTypesInList();
            globalFunc.loadRootNodesInTree();
            globalFunc.loadTree();
            console.timeEnd("loading data in components");

            var springLength = 200;
            var displayedChildNodes = Math.ceil(maxChildNodes / (gAllNodes.length / nbNodesToDisplay));
            var springLengthCoeff = (displayedChildNodes <= 250 ? 1 : displayedChildNodes / 250);
            layout = Viva.Graph.Layout.forceDirected(g, {
                springLength : springLength * springLengthCoeff,
                springCoeff : 0.0008,
                dragCoeff : 0.02
            });

            renderer = Viva.Graph.View.renderer(g, {
                graphics : graphics,
                layout: layout,
                container: divGraph,
                prerender: 50
            });

            $('#loadingText').hide();

            renderer.run();
            console.timeEnd("rendering+loading");

            console.time("table+events");
            createTableLayout();
            initJQueryEvents();
            console.timeEnd("table+events");

            console.timeEnd("all");
        });
    });


}
1075924
function _recursiveDeps(graph, name, deps) {
  return Object.keys(deps).forEach((key) => {
    const dep = deps[key];
    if (PLUGIN.test(dep)) {
      return;
    }
    if (typeof dep === 'string') {
      if (!graph.hasNode(dep)) {
        graph.addNode(dep);
      }
      graph.addDependency(name, dep);
    } else if (typeof dep === 'object') {
      _recursiveDeps(graph, name, deps[key]);
    }
  });
}
357031
def add_vertex(self, v, partition):
        
        self.graph.add_vertex(v)
        self.partitions[partition].add(v)
150322
function addNodeToGraph(node){

    gNodesDisplayed.push(node);
    g.addNode(node._id, node);


    if (contains(childrenNodes, node._id)){
        var parentNode = getNodeFromId(nodesToBeLinked[node._id].from);
        if (contains(gNodesDisplayed, parentNode)){
            addLinkToParent(node._id, parentNode._id);
        }
    }
}
945457
function saveGraphSON(graph, filename, callback) {
        var FileOutputStream = Tinkerpop.autoImport('FileOutputStream');
        var stream = new FileOutputStream(filename);
        return Tinkerpop.GraphSONWriter.buildP()
            .then(function (builder) {
            return _newGraphSONMapper()
                .then(function (mapper) { return builder.mapperP(mapper); });
        })
            .then(function (builder) { return builder.createP(); })
            .then(function (writer) { return writer.writeGraphP(stream, graph); })
            .then(function () { return graph; })
            .nodeify(callback);
    }
229262
def dependency(self, node1, node2):
        ""
        self.graph.add_node(node1)
        self.graph.add_node(node2)
        self.graph.add_edge(node2, node1)
452541
function(graph, opt) {

        opt = opt || {};

        var glGraphType = joint.util.pick(opt, 'directed', 'compound', 'multigraph');
        var glGraph = new graphlib.Graph(glGraphType);
        var setNodeLabel = opt.setNodeLabel || joint.util.noop;
        var setEdgeLabel = opt.setEdgeLabel || joint.util.noop;
        var setEdgeName = opt.setEdgeName || joint.util.noop;
        var collection = graph.get('cells');

        for (var i = 0, n = collection.length; i < n; i++) {

            var cell = collection.at(i);
            if (cell.isLink()) {

                var source = cell.get('source');
                var target = cell.get('target');

                // Links that end at a point are ignored.
                if (!source.id || !target.id) break;

                // Note that if we are creating a multigraph we can name the edges. If
                // we try to name edges on a non-multigraph an exception is thrown.
                glGraph.setEdge(source.id, target.id, setEdgeLabel(cell), setEdgeName(cell));

            } else {

                glGraph.setNode(cell.id, setNodeLabel(cell));

                // For the compound graphs we have to take embeds into account.
                if (glGraph.isCompound() && cell.has('parent')) {
                    var parentId = cell.get('parent');
                    if (collection.has(parentId)) {
                        // Make sure the parent cell is included in the graph (this can
                        // happen when the layout is run on part of the graph only).
                        glGraph.setParent(cell.id, parentId);
                    }
                }
            }
        }

        return glGraph;
    }
342024
void build(int nodeOffset, GraphMeshData graphData, List<int[]> connections) {
		for (int n = 0; n < connections.size(); n++) {
			int[] nodeConnections = connections.get(n);
			MeshData tile = graphData.getTile(n);
			Poly node = graphData.getNode(n);
			for (int connection : nodeConnections) {
				MeshData neighbourTile = graphData.getTile(connection - nodeOffset);
				if (neighbourTile != tile) {
					buildExternalLink(tile, node, neighbourTile);
				} else {
					Poly neighbour = graphData.getNode(connection - nodeOffset);
					buildInternalLink(tile, node, neighbourTile, neighbour);
				}
			}
		}
	}
840342
def output_component(graph, edge_stack, u, v):
    """"""
    edge_list = []
    while len(edge_stack) > 0:
        edge_id = edge_stack.popleft()
        edge_list.append(edge_id)

        edge = graph.get_edge(edge_id)
        tpl_a = (u, v)
        tpl_b = (v, u)
        if tpl_a == edge['vertices'] or tpl_b == edge['vertices']:
            break

    return edge_list