Skip to main content
Module

x/structurae/adjacency-matrix-unweighted-undirected.ts

Data structures for high-performance JavaScript applications.
Latest
File
import { AdjacencyMatrixUnweightedDirected } from "./adjacency-matrix-unweighted-directed.ts";
/** * Implements the Adjacency Matrix data structure for unweighted undirected graphs. */export class AdjacencyMatrixUnweightedUndirected extends AdjacencyMatrixUnweightedDirected { static directed = false; static getLength(vertices: number): number { return (((vertices + 1) * vertices) >> 6) + 2; } getIndex(x: number, y: number): number { return x >= y ? y + (((x + 1) * x) >> 1) : x + (((y + 1) * y) >> 1); }}