The following is a web component, a custom HTML element, which the current version of HTML allows for.
This allows for greater encapsulation in web development.
This web component displays a graph with a background color, and Javascript-specified vertices and edges.
To use it, include
dynamic-graph.bundle.min.js
fourd.wasm
in the same directory on your web server.
The API should be familiar to anyone who's seen my other projects:
int add_vertex({cube: {size: 10, color: 'black'}}) creates a vertex and returns its id.
void remove_vertex(vertex_id) removes a vertex
int add_edge(source_vertex_id, target_vertex_id, {color: 'white'}) creates an edge between source and target, and returns its id
void remove_vertex(edge_id) removes an edge
Open your browser's developer console to see vertex ids