Example #1
0
 /**
  * @param  GraphSchema $schema
  * @param  null|int    $seed
  * @return Graph
  */
 public function process(GraphSchema $schema, $seed = null)
 {
     $this->nodesByIdentifier = new ObjectCollection();
     $this->nodes = new ObjectCollection();
     $this->relationships = new ObjectCollection();
     foreach ($schema->getNodes() as $node) {
         $this->processNodeDefinition($node, $seed);
     }
     foreach ($schema->getRelationships() as $relationship) {
         $this->processRelationshipDefinition($relationship, $seed);
     }
     $graph = new Graph();
     $graph->setNodes($this->nodes);
     $graph->setEdges($this->relationships);
     $graph->setSchema($schema);
     return $graph;
 }