dao-governance-framework/forum-network/public/tests/graph.html

34 lines
789 B
HTML

<!DOCTYPE html>
<head>
<title>Forum Graph</title>
<link type="text/css" rel="stylesheet" href="/index.css" />
</head>
<body>
<div id="graph-test"></div>
</body>
<script type="module">
import { Box } from "/classes/box.js";
import { Scene } from "/classes/scene.js";
import { Graph } from "/classes/graph.js";
const rootElement = document.getElementById("graph-test");
const rootBox = new Box("rootBox", rootElement).flex();
window.scene = new Scene("Graph test", rootBox);
window.graph = new Graph();
window.v = [];
function addVertex() {
const vertex = window.graph.addVertex({ seq: window.v.length });
window.v.push(vertex);
}
addVertex();
addVertex();
addVertex();
addVertex();
addVertex();
window.graph.addEdge("e1", 0, 1);
</script>