Creates a GraphViz Edge between two nodes.

@param Graph  $graph
@param string $from_name
@param string|ClassDescriptor|InterfaceDescriptor|TraitDescriptor $to

@return Edge|null
5884
protected function createEdge($graph, $from_name, $to)
    {
        $to_name = (string) ($to instanceof DescriptorAbstract ? $to->getFullyQualifiedStructuralElementName() : $to);

        if (!isset($this->nodeCache[$from_name])) {
            $namespaceParts = explode('\\', $from_name);
            $this->nodeCache[$from_name] = $this->createEmptyNode(
                array_pop($namespaceParts),
                $this->createNamespaceGraph($from_name)
            );
        }

        if (!isset($this->nodeCache[$to_name])) {
            $namespaceParts = explode('\\', $to_name);
            $this->nodeCache[$to_name] = $this->createEmptyNode(
                array_pop($namespaceParts),
                $this->createNamespaceGraph($to_name)
            );
        }

        $fromNode = $this->nodeCache[$from_name];
        $toNode = $this->nodeCache[$to_name];
        if ($fromNode !== null && $toNode !== null) {
            return Edge::create($fromNode, $toNode);
        }

        return null;
    }
765510
protected function deleteRelationData($from, $to)
    {
        $config  = Config::table($from);
        $content = $config->get();
        unset($content->relations->{$to});
        $config->put($content);
    }
780934
public static function createFrom(self $from, $to = null)
    {
        $request = $to ?: new static;

        $files = $from->files->all();

        $files = is_array($files) ? array_filter($files) : $files;

        $request->initialize(
            $from->query->all(),
            $from->request->all(),
            $from->attributes->all(),
            $from->cookies->all(),
            $files,
            $from->server->all(),
            $from->getContent()
        );

        $request->headers->replace($from->headers->all());

        $request->setJson($from->json());

        if ($session = $from->getSession()) {
            $request->setLaravelSession($session);
        }

        $request->setUserResolver($from->getUserResolver());

        $request->setRouteResolver($from->getRouteResolver());

        return $request;
    }
91773
public function createScript(Graph $graph)
    {
        $alg = new Directed($graph);
        $directed = $alg->hasDirected();

        /*
         * The website [http://www.graphviz.org/content/dot-language] uses the term `ID` when displaying
         * the abstract grammar for the DOT language.
         * But the man pages for dot use the term `name` when describing the graph file language.
         */
        $name = $graph->getAttribute('graphviz.name');
        if ($name !== null) {
            $name = $this->escapeId($name) . ' ';
        }

        $script = ($directed ? 'di':'') . 'graph ' . $name . '{' . self::EOL;

        // add global attributes
        $globals = array(
            'graph' => 'graphviz.graph.',
            'node'  => 'graphviz.node.',
            'edge'  => 'graphviz.edge.',
        );

        foreach ($globals as $key => $prefix) {
            $bag = new AttributeBagNamespaced($graph, $prefix);

            if ($layout = $bag->getAttributes()) {
                $script .= $this->formatIndent . $key . ' ' . $this->escapeAttributes($layout) . self::EOL;
            }
        }

        $alg = new Groups($graph);
        // only append group number to vertex label if there are at least 2 different groups
        $showGroups = ($alg->getNumberOfGroups() > 1);

        if ($showGroups) {
            $gid = 0;
            $indent = str_repeat($this->formatIndent, 2);
            // put each group of vertices in a separate subgraph cluster
            foreach ($alg->getGroups() as $group) {
                $script .= $this->formatIndent . 'subgraph cluster_' . $gid++ . ' {' . self::EOL .
                           $indent . 'label = ' . $this->escape($group) . self::EOL;
                foreach($alg->getVerticesGroup($group)->getMap() as $vid => $vertex) {
                    $layout = $this->getLayoutVertex($vertex);

                    $script .= $indent . $this->escapeId($vid);
                    if($layout){
                        $script .= ' ' . $this->escapeAttributes($layout);
                    }
                    $script .= self::EOL;
                }
                $script .= '  }' . self::EOL;
            }
        } else {
            $alg = new Degree($graph);

            // explicitly add all isolated vertices (vertices with no edges) and vertices with special layout set
            // other vertices wil be added automatically due to below edge definitions
            foreach ($graph->getVertices()->getMap() as $vid => $vertex){
                $layout = $this->getLayoutVertex($vertex);

                if($layout || $alg->isVertexIsolated($vertex)){
                    $script .= $this->formatIndent . $this->escapeId($vid);
                    if($layout){
                        $script .= ' ' . $this->escapeAttributes($layout);
                    }
                    $script .= self::EOL;
                }
            }
        }

        $edgeop = $directed ? ' -> ' : ' -- ';

        // add all edges as directed edges
        foreach ($graph->getEdges() as $currentEdge) {
            $both = $currentEdge->getVertices()->getVector();
            $currentStartVertex = $both[0];
            $currentTargetVertex = $both[1];

            $script .= $this->formatIndent . $this->escapeId($currentStartVertex->getId()) . $edgeop . $this->escapeId($currentTargetVertex->getId());

            $layout = $this->getLayoutEdge($currentEdge);

            // this edge also points to the opposite direction => this is actually an undirected edge
            if ($directed && $currentEdge->isConnection($currentTargetVertex, $currentStartVertex)) {
                $layout['dir'] = 'none';
            }
            if ($layout) {
                $script .= ' ' . $this->escapeAttributes($layout);
            }

            $script .= self::EOL;
        }
        $script .= '}' . self::EOL;

        return $script;
    }
1340679
public static function move($names, &$from, &$to)
    {
        if (is_array($from) && is_array($to)) {
            foreach ($names as $key) {
                if (isset($from[$key]) && !isset($to[$key])) {
                    $to[$key] = static::getValue($from, $key);
                    $moved[$key] = static::removeValue($from, $key);
                }
            }
        }
        return $moved;
    }
268340
public function alias($from, $to = null)
	{
		if (is_array($from))
		{
			$this->aliases = array_merge($this->aliases, $from);

			return $this;
		}

		$this->aliases[$from] = $to;
		$this->cache->set($from, $to);
	}
1110945
def createEdge(self, collectionName, _fromId, _toId, edgeAttributes, waitForSync = False) :
        """"""

        if not _fromId :
            raise ValueError("Invalid _fromId: %s" % _fromId)

        if not _toId :
            raise ValueError("Invalid _toId: %s" % _toId)

        if collectionName not in self.definitions :
            raise KeyError("'%s' is not among the edge definitions" % collectionName)

        url = "%s/edge/%s" % (self.URL, collectionName)
        self.database[collectionName].validatePrivate("_from", _fromId)
        self.database[collectionName].validatePrivate("_to", _toId)
        
        ed = self.database[collectionName].createEdge()
        ed.set(edgeAttributes)
        ed.validate()

        payload = ed.getStore()
        payload.update({'_from' : _fromId, '_to' : _toId})

        r = self.connection.session.post(url, data = json.dumps(payload, default=str), params = {'waitForSync' : waitForSync})
        data = r.json()
        if r.status_code == 201 or r.status_code == 202 :
            return self.database[collectionName][data["edge"]["_key"]]
        # print "\ngraph 160, ", data, payload, _fromId
        raise CreationError("Unable to create edge, %s" % r.json()["errorMessage"], data)
117583
private function loadGraph(Graph $graph)
    {
        foreach ($graph->nodes as $node) {
            $this->addNode($node);
        }

        foreach ($graph->edges as $edge) {
            $this->addEdge($edge);
        }

        foreach ($graph->initializers as $initializer) {
            $this->addInitial(
                $initializer[self::SOURCE][self::DATA],
                $initializer[self::TARGET][self::NODE],
                $initializer[self::TARGET][self::PORT]
            );
        }
    }
693314
public function afterPatch( $from, $to )
    {
        $schema = $this->getPatchData()
                       ->get( 'db', 'schema' );

        if ( is_array( $schema ) )
        {
            $schema = reset( $schema );
        }

        if ( $this->isZeroVersion( $from ) )
        {
            $developer = $this->selectFromTable( 'user', 'id', array(
                'groupId' => static::DEVELOPER_GROUP,
            ) );

            if ( ! $developer )
            {
                $developer = $this->insertDeveloper();
            }

            $platformOwner = $this->selectFromTable( 'user', 'id', array(
                'groupId' => static::SITE_OWNER_GROUP,
            ) );

            if ( ! $platformOwner )
            {
                $platformOwner = $this->insertPlatformOwner();
            }

            $content = $this->selectFromTable( 'paragraph', 'id', array(
                'type' => 'content',
            ) );

            if ( ! $content )
            {
                $content = $this->insertDefaultParagraph( 'content' );
            }

            $menu = $this->selectFromTable( 'menu', 'id' );

            if ( ! $menu )
            {
                $menu = $this->insertDefaultMenu( $content );
            }

            $layout = $this->selectFromTable( 'paragraph', 'id', array(
                'type' => 'layout',
            ) );

            if ( ! $layout )
            {
                $layout = $this->insertDefaultParagraph( 'layout' );
            }

            $subDomain = $this->selectFromTable( 'subdomain', 'id', array(
                'subdomain' => '',
            ) );

            if ( ! $subDomain )
            {
                $subDomain = $this->insertDefaultSubDomain( $layout, $content );
            }

            if ( ! empty( $schema ) )
            {
                foreach ( $this->uploadsDirs as $uploadsDir )
                {
                    @ mkdir(
                        implode( DIRECTORY_SEPARATOR, array(
                            '.',
                            'public',
                            'uploads',
                            $schema,
                            str_replace( '/', DIRECTORY_SEPARATOR, $uploadsDir )
                        ) ),
                        0777,
                        true
                    );
                }

                foreach ( $this->uploadsFiles as $uploadsFile => $copyFrom )
                {
                    @ copy(
                        str_replace( '/', DIRECTORY_SEPARATOR, $copyFrom ),
                        implode( DIRECTORY_SEPARATOR, array(
                            '.',
                            'public',
                            'uploads',
                            $schema,
                            str_replace( '/', DIRECTORY_SEPARATOR, $uploadsFile )
                        ) )
                    );
                }
            }
        }
        else
        {
            $schemas = array( $schema );

            if ( $this->getPatcher()
                      ->isMultisite() )
            {
                $schemas = $this->selectColumnFromTable(
                    array( '_central', 'site' ),
                    'schema'
                );
            }

            foreach ( $schemas as $schema )
            {
                $extraCssFile = 'public/uploads/' . $schema . '/customize/extra.css';

                if ( file_exists( $extraCssFile ) && is_readable( $extraCssFile ) )
                {
                    $extraCss = preg_replace(
                        '/^\s*@charset\s+(["\'][^"\']+["\']|[^;]+)\s*;\s+/',
                        '',
                        @ file_get_contents( $extraCssFile )
                    );

                    if ( ! empty( $extraCss ) )
                    {
                        $this->appendCustomizeGlobalExtra( $extraCss, $schema );
                        $this->getInstaller()
                             ->patchLog( 'customize extra %s merged', $extraCssFile );
                    }

                    @ unlink( $extraCssFile );
                }
            }
        }

        $this->mergePackagesConfig();
    }
482523
protected function useClass($toClassName, $fromClassname)
    {
        $this->toClassName   = $toClassName;
        $this->fromClassname = $fromClassname;
        return $this;
    }
337009
private Stream<Quad> fetchAllFromGraph(final String fromGraphName, final IRI toGraphName) {
        final Query q = new Query();
        q.setQuerySelectType();
        q.addResultVar(SUBJECT);
        q.addResultVar(PREDICATE);
        q.addResultVar(OBJECT);

        final ElementPathBlock epb = new ElementPathBlock();
        epb.addTriple(create(SUBJECT, PREDICATE, OBJECT));

        final ElementGroup elg = new ElementGroup();
        elg.addElement(new ElementNamedGraph(createURI(fromGraphName), epb));

        q.setQueryPattern(elg);

        final Stream.Builder<Quad> builder = builder();
        rdfConnection.querySelect(q, qs -> builder.accept(rdf.createQuad(toGraphName,
                        getSubject(qs), getPredicate(qs), getObject(qs))));
        return builder.build();
    }
681335
protected function publishItem($from, $to)
    {
        if ($this->files->isFile($from)) {
            return $this->publishFile($from, $to);
        } elseif ($this->files->isDirectory($from)) {
            return $this->publishDirectory($from, $to);
        }

        $this->error("Can't locate path: <{$from}>");
    }
570980
function (graph, opts, params) {
    if (graph.children.length == 0) return '';

    function getRels(node) {
      var rels = [];
      node.children.forEach(function(childNode) {
        rels.push('(' + node.name + ')-[__rel_' + childNode.name + ':' + childNode.comp.rel + ']->(' + childNode.name + ')');
        rels.push.apply(rels, getRels(childNode));
      });
      return rels;
    }
    
    return 'CREATE UNIQUE ' + getRels(graph).join(',');
  }
759435
function ($from) {
                        if ($from.length !== 0) {
                            var $finalParagraph = $from.nextUntil(blockElementsSelector).addBack().wrapAll('<p/>').parent(),
                                $nextElement = $finalParagraph.nextAll(inlineElementsSelector).first();
                            $finalParagraph.next('br').remove();
                            wrapInlinesInParagraphsFrom($nextElement);
                        }
                    }
1172624
public function sendPresence($to, $from = NULL, $type = NULL) {
		$type = is_null($type) ? '' : " type=\"{$type}\"";
		return $this->send('<presence to="' . htmlspecialchars($to) . '" from="' . (is_null($from) ? $this->component_name : htmlspecialchars("$from@{$this->component_name}")) . '"' . $type . ' />');
	}
884651
public static function createWithoutLoop(Path $path, int $from, int $to): Path
    {
        $fromPlaces = $path->getPlacesAt($from);
        $toPlaces = $path->getPlacesAt($to);
        if (!array_diff($fromPlaces, $toPlaces)) {
            return static::create($path, $from, $to, [], [], []);
        } else {
            throw new Exception('Can not create new path without loop');
        }
    }
1044503
public function copy($from, $to)
    {
        $pathFrom = $this->pathRoot.ltrim($from, "/");
        $pathTo   = $this->pathRoot.ltrim($to, "/");

        if (is_dir($pathFrom)) {
            return $this->copyDir($pathFrom, $pathTo);
        } else {
            return $this->copyFile($pathFrom, $pathTo);
        }
    }