Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Graph<T>

Type parameters

  • T

Hierarchy

  • Graph

Implements

Index

Constructors

constructor

Properties

Private _adjacencyList

_adjacencyList: Map<T, PriorityQueue<Connection<T>>>

Private _hasNegativeWeights

_hasNegativeWeights: boolean

Methods

add

  • add(vertex: T): void

bellmanFord

  • bellmanFord(from: T, to: T): { distance: number; path: T[] }
  • Requires no negative cycles Complexity O(VE)

    Parameters

    • from: T

      Vertex

    • to: T

      Vertex

    Returns { distance: number; path: T[] }

    • distance: number
    • path: T[]

connect

connectionExists

  • connectionExists(connection: Connection<T>): boolean

dijkstra

  • dijkstra(from: T, to: T): { distance: number; path: T[] }
  • Requires no negative weights Complexity O(V + E log V)

    Parameters

    • from: T
    • to: T

    Returns { distance: number; path: T[] }

    • distance: number
    • path: T[]

exists

  • exists(node: T): boolean

getEdges

getEdgesFor

getVertices

  • getVertices(): T[]

minimumSpanningTree

  • minimumSpanningTree(): Graph<T>

Private newConnectionPriorityQueue

shortestPath

  • shortestPath(from: T, to: T): T[]

Generated using TypeDoc