Class Graph<TNodeSize, TNode>

Node Graph

Type Parameters

  • TNodeSize extends number

  • TNode extends number = Node<TNodeSize>

Hierarchy

  • Graph

Constructors

  • Type Parameters

    • TNodeSize extends number

    • TNode extends number = Node<TNodeSize>

    Parameters

    Returns Graph<TNodeSize, TNode>

Properties

data: GraphMetaData<TNodeSize, TNode>
distances?: NodeDistances<TNodeSize>
length: number
list: Map<TNode, TNode[]> = ...
matrix?: AdjacencyMatrix<TNodeSize, TNode>
nodes: FixedArray<TNodeSize, null | TNode>
path?: NodePath<TNode>
regions: Map<string, Region<TNodeSize, TNode>> = ...

Methods

  • Adds edge between two existing nodes

    Parameters

    • edge: Edge<TNode>
    • Optional bidirectional: boolean = true

    Returns void

  • Parameters

    • Optional edges: EdgeArray<TNode>
    • Optional callback: ((edge, bidirectional, conditional) => void)
        • (edge, bidirectional, conditional): void
        • Parameters

          • edge: [a: number, b: number]
          • bidirectional: boolean
          • conditional: boolean

          Returns void

    • bidirectional: boolean = true
    • conditional: boolean = false

    Returns void

  • Parameters

    • regionLhs: Region<TNodeSize, TNode>
    • regionRhs: Region<TNodeSize, TNode>

    Returns Region<TNodeSize, TNode>

  • Depth-first search

    Parameters

    • start: NonNullable<TNode>
    • target: NonNullable<TNode>

    Returns (undefined | TNode)[]

    path from start to target

  • Parameters

    • callback: ((edge, bidirectional, conditional) => void)
        • (edge, bidirectional, conditional): void
        • Parameters

          • edge: [a: number, b: number]
          • bidirectional: boolean
          • conditional: boolean

          Returns void

    • conditions: string[]

    Returns void

  • Parameters

    • callback: ((node) => void)
        • (node): void
        • Parameters

          • node: number

          Returns void

    Returns void

  • Parameters

    • reach: TNode

    Returns TNode[]

  • Parameters

    • start: null | TNode
    • path: NodePath<TNode>
    • Optional callback: ((node) => void)
        • (node): void
        • Parameters

          • node: null | TNode

          Returns void

    Returns void

  • Walk through linked list of Nodes representing the path to walk to target, where the last node is guaranteed to be the expected target.

    Parameters

    • path: (null | TNode)[]
    • Optional callback: ((node) => void)
        • (node): void
        • Parameters

          • node: null | TNode

          Returns void

    Returns void

  • Walk through linked list of Nodes representing the path to walk to target, where the last node is guaranteed to be the expected target.

    Parameters

    • path: (null | TNode)[]
    • target: null | TNode
    • Optional callback: ((node) => void)
        • (node): void
        • Parameters

          • node: null | TNode

          Returns void

    Returns boolean

Generated using TypeDoc