Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Graph<N, E>

Type parameters

  • N

  • E

Hierarchy

  • Graph

Index

Constructors

constructor

  • new Graph(opt?: Object): Graph

Methods

edge

  • edge(fromName: string, toName: string): E
  • edge(edgeObject: EdgeObject): E

edges

graph

hasEdge

  • hasEdge(fromName: string, toName: string): boolean
  • Parameters

    • fromName: string
    • toName: string

    Returns boolean

hasNode

  • hasNode(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

inEdges

  • inEdges(name: string): E[]

neighbors

  • neighbors(name: string): string[]
  • Parameters

    • name: string

    Returns string[]

node

  • node(name: string): N

nodeCount

  • nodeCount(): number

nodes

  • nodes(): string[]

outEdges

  • outEdges(name: string): E[]

predecessors

  • predecessors(name: string): string[]
  • Parameters

    • name: string

    Returns string[]

removeEdge

  • removeEdge(v: string, w: string): void
  • Parameters

    • v: string
    • w: string

    Returns void

removeNode

  • removeNode(name: string): void
  • removeNode(name: string): Graph<N, E>
  • Parameters

    • name: string

    Returns void

  • Remove the node with the id v in the graph or do nothing if the node is not in the graph. If the node was removed this function also removes any incident edges. Returns the graph, allowing this to be chained with other functions. Takes O(|E|) time.

    Parameters

    • name: string

    Returns Graph<N, E>

setEdge

  • setEdge(fromName: string, toName: string, value?: E): void
  • Parameters

    • fromName: string
    • toName: string
    • Optional value: E

    Returns void

setGraph

setNode

  • setNode(name: string, value?: N): void
  • Parameters

    • name: string
    • Optional value: N

    Returns void

setParent

  • setParent(name: string, parentName: string): void
  • Parameters

    • name: string
    • parentName: string

    Returns void

sources

  • sources(): string[]
  • Returns those nodes in the graph that have no in-edges. Takes O(|V|) time.

    Returns string[]

successors

  • successors(name: string): string[]
  • Parameters

    • name: string

    Returns string[]

Generated using TypeDoc