PHP code example of graphp / trivial-graph-format
1. Go to this page and download the library: Download graphp/trivial-graph-format library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
graphp / trivial-graph-format example snippets
$graph = new Fhaculty\Graph\Graph();
$a = $graph->createVertex('a');
$b = $graph->createVertex('b');
$a->createEdgeTo($b);
$exporter = new Graphp\TrivialGraphFormat\TrivialGraphFormat();
$data = $exporter->getOutput($graph);
file_put_contents('example.tgf', $data);
echo $data;