Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AdjacencyBitMatrix

Adjacency matrix representation for both directed and undirected graphs and using a compact bit matrix to store edges. Each edge requires only 1 bit in directed graphs or 2 bits in undirected graphs. E.g. this is allows storing 16384 directed edges in just 2KB of memory (128 * 128 / 8 = 2048).

Hierarchy

  • AdjacencyBitMatrix

Implements

Index

Constructors

constructor

Properties

mat

mat: BitMatrix

Protected numE

numE: number

Protected undirected

undirected: boolean

Methods

addEdge

  • addEdge(from: number, to: number): boolean

degree

edges

  • edges(): Generator<Edge<number>, void, unknown>
  • Returns iterator of all edges in the graph. Each edge is a tuple of [from, to]. For undirected graphs each edge will only be emitted once.

    Returns Generator<Edge<number>, void, unknown>

hasEdge

  • hasEdge(from: number, to: number): boolean

invert

neighbors

  • neighbors(id: number): number[]

numEdges

  • numEdges(): number

numVertices

  • numVertices(): number

removeEdge

  • removeEdge(from: number, to: number): boolean

resize

toDot

  • toDot(ids?: string[]): string

toString

  • toString(): string

Generated using TypeDoc