Digraph is a directed graph with 0 or 1 directed edge between two vertices. Therefore, there are at maximum two edges between two vertices (the two directions)
Inheritance: implements Trismegiste\Mondrian\Graph\Graph
Beispiel #1
0
 public function __construct()
 {
     parent::__construct();
     $set = [new ClassVertex('Guess\\What\\I\\Draw'), new TraitVertex('Guess\\What\\I\\Draw'), new ImplVertex('Guess\\What\\I\\Draw::yop'), new MethodVertex('Guess\\What\\I\\Draw::yop'), new ParamVertex('Guess\\What\\I\\Draw::yop/0')];
     for ($k = 0; $k < 5; $k++) {
         $this->addEdge($set[2 * $k % 5], $set[(2 * $k + 2) % 5]);
     }
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $graph = new Digraph();
     $logger = new NullLogger();
     $compil = new Linking(new Builder(), new GraphBuilder($this->fineTuning, $graph, $logger));
     $output->writeln(sprintf("Parsing %d files...", $this->phpfinder->count()));
     $compil->run($this->phpfinder->getIterator());
     $output->writeln(sprintf("Processing digraph with %d vertices and %d edges...", count($graph->getVertexSet()), count($graph->getEdgeSet())));
     $processed = $this->processGraph($graph, $output);
     $ff = new Factory();
     $dumper = $ff->create($processed, $this->reportFormat);
     file_put_contents($this->reportName, $dumper->export());
     $output->writeln("Report {$this->reportName} created");
     if ($output->getVerbosity() == OutputInterface::VERBOSITY_VERBOSE) {
         $output->writeln(sprintf("<comment>%.0f MB used</comment>", memory_get_peak_usage() / 1000000.0));
     }
 }