Updated demos.

This commit is contained in:
Henning Dieterichs
2020-02-19 15:14:11 +01:00
parent 5bc4347f3c
commit 27b9bc1905
27 changed files with 793 additions and 82 deletions

26
demo/php/demo.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
$graph = [
"kind" => ["graph" => true],
"nodes" => [
["id" => "1", "label" => "1"]
],
"edges" => []
];
// Visualize "$visualize()"
$visualize = function () use (&$graph) {
return json_encode($graph);
};
for ($i = 2; $i < 100; $i++) {
$targetId = "" . random_int(1, $i - 1);
$id = "" . $i;
array_push($graph["nodes"], ["id" => $id, "label" => $id]);
array_push($graph["edges"], ["from" => $id, "to" => "" . $targetId]);
xdebug_break();
}
echo "finished";