Adjacency list code bricks for JavaScript. Follows the specification in @graph-data-structure/specification. Parent is @aureooms/js-gn.
⚠️ Depending on your environment, the code may requireregeneratorRuntime
to be defined, for instance by importing regenerator-runtime/runtime.
for ( let v of V( G ) ) ... ;
import {DoublyLinkedList as List} from '@list-abstraction/doubly-linked-list';
import {MultiGraph, MultiDiGraph} from '@graph-data-structure/adjacency-list';
let MultiGraph = MultiGraph( List ) ;
// use `MultiDiGraph( List , Map )` for directed multigraphs ;
// (`Map` is the new es6 class, or any other polyfill implementation)
let { V , E , N } = require( "@aureooms/js-graph-theory-notation" ) ;
let G = new Graph( ) ;
let u = G.vadd( ) ;
let v = G.vadd( ) ;
let e = G.eadd( u , v ) ;
for ( let w of V( G ) ) ... ;
for ( let e of E( G ) ) ... ;
for ( let w of N( G , u ) ) ... ;
G.edel( e ) ;
G.vdel( v ) ;
G.vdel( u ) ;