Options
All
  • Public
  • Public/Protected
  • All
Menu

The Graph class is a data structure that allow you to create a directed graph, in which to add, remove and modify nodes and arcs in constant time. Nodes and arcs are stored in maps.

Hierarchy

  • Graph

Index

Constructors

constructor

Properties

Private nodes

nodes: Map<number, Node>

Methods

addNode

  • addNode(node: Node): void

checkIntegrity

  • checkIntegrity(): boolean
  • Checks the integrity of the graph. All the arcs must have an existing head node.

    Returns boolean

    True if the graph is correct, false otherwise.

copy

export

getNode

  • getNode(id: number): Node

getNodes

  • getNodes(): Node[]

hasNode

  • hasNode(id: number): boolean

removeNode

  • removeNode(id: number): void

size

  • size(): number
  • Returns the number of the nodes of the graph.

    Returns number

    The number of the graph nodes.

Legend

  • Constructor
  • Property
  • Method
  • Private property

Generated using TypeDoc