Options
All
  • Public
  • Public/Protected
  • All
Menu

calculates all-pairs shortest paths or shortest paths from a single node

class

Calculator

constructor
param

number of nodes

param

array of edges

Type parameters

  • Link

Hierarchy

  • Calculator

Index

Constructors

constructor

  • new Calculator(n: number, es: Link[], getSourceIndex: function, getTargetIndex: function, getLength: function): Calculator
  • Parameters

    • n: number
    • es: Link[]
    • getSourceIndex: function
        • (l: Link): number
        • Parameters

          • l: Link

          Returns number

    • getTargetIndex: function
        • (l: Link): number
        • Parameters

          • l: Link

          Returns number

    • getLength: function
        • (l: Link): number
        • Parameters

          • l: Link

          Returns number

    Returns Calculator

Properties

es

es: Link[]

n

n: number

Private neighbours

neighbours: Node[]

Methods

DistanceMatrix

  • DistanceMatrix(): number[][]
  • compute shortest paths for graph over n nodes with edges an array of source/target pairs edges may optionally have a length attribute. 1 is the default. Uses Johnson's algorithm.

    method

    DistanceMatrix

    Returns number[][]

    the distance matrix

DistancesFromNode

  • DistancesFromNode(start: number): number[]
  • get shortest paths from a specified start node

    method

    DistancesFromNode

    Parameters

    • start: number

      node index

    Returns number[]

    array of path lengths

PathFromNodeToNode

  • PathFromNodeToNode(start: number, end: number): number[]

PathFromNodeToNodeWithPrevCost

  • PathFromNodeToNodeWithPrevCost(start: number, end: number, prevCost: function): number[]
  • Parameters

    • start: number
    • end: number
    • prevCost: function
        • (u: number, v: number, w: number): number
        • Parameters

          • u: number
          • v: number
          • w: number

          Returns number

    Returns number[]

Private dijkstraNeighbours

  • dijkstraNeighbours(start: number, dest?: number): number[]
  • Parameters

    • start: number
    • Default value dest: number = -1

    Returns number[]

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc