Improves styling & demos.

This commit is contained in:
Henning Dieterichs
2020-02-23 13:10:10 +01:00
parent a4edf492f8
commit 07a5a42ec6
10 changed files with 107 additions and 50 deletions

View File

@@ -1,5 +1,12 @@
<?php
// Install php, xdebug and the php debug extension for VS Code
// (https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug).
// The Debug Visualizer has no support for PHP data extractors yet,
// so to visualize data, your value must be a valid JSON string representing the data.
// See readme for supported data schemas.
$graph = [
"kind" => ["graph" => true],
"nodes" => [
@@ -7,7 +14,6 @@ $graph = [
],
"edges" => []
];
// Visualize "$visualize()"
$visualize = function () use (&$graph) {
return json_encode($graph);
@@ -16,13 +22,12 @@ $visualize = function () use (&$graph) {
for ($i = 2; $i < 100; $i++) {
// add a node
$id = "" . $i;
array_push($graph["nodes"], ["id" => $id, "label" => $id]);
array_push($graph["nodes"],
["id" => $id, "label" => $id]);
// connects the node to a random edge
$targetId = "" . random_int(1, $i - 1);
array_push($graph["edges"], ["from" => $id, "to" => "" . $targetId]);
xdebug_break();
array_push($graph["edges"],
["from" => $id, "to" => "" . $targetId]);
}
echo "finished";