Skip to main content
Module

x/structurae/index.ts>AdjacencyStructure

Data structures for high-performance JavaScript applications.
Latest
interface AdjacencyStructure
implements IndexedCollection
import { type AdjacencyStructure } from "https://deno.land/x/structurae@4.0.1/index.ts";

Properties

empty: unknown
vertices: number

The number of vertices.

edges: number

The maximum number of edges.

Methods

addEdge(
x: number,
y: number,
weight?: number,
): this

Adds an edge between two vertices.

getEdge(x: number, y: number): number

Returns the weight of the edge between given vertices or NaN if the edge doesn't exist.

hasEdge(x: number, y: number): boolean

Checks if there is an edge between two vertices.

inEdges(x: number): Generator<number, void, unknown>

Iterates over incoming edges of a vertex.

isFull(): boolean

Check if all available edges are set.

outEdges(x: number): Generator<number, void, unknown>

Iterates over outgoing edges of a vertex.

removeEdge(x: number, y: number): this

Removes an edge between two vertices.