Options
All
  • Public
  • Public/Protected
  • All
Menu

A dependency graph models relationships between nodes. The graph is directed and asyclic, throwing a circular dependency exception if circular dependencies are added.

Type parameters

  • T

Hierarchy

  • DependencyGraph

Index

Constructors

constructor

  • Constructs an empty dependency graph.

    Returns DependencyGraph

Methods

add

  • add(node: T): void
  • Adds a node into the dependency graph. If the node already exists within the graph, does nothing.

    Parameters

    • node: T

    Returns void

addDependency

  • addDependency(from: T, to: T): void
  • Adds a dependency between two nodes. If either of the nodes do not exist within the dependency graph, throws an exception.

    Parameters

    • from: T
    • to: T

    Returns void

contains

  • contains(node: T): boolean
  • Returns true if the node exists within the dependency graph.

    Parameters

    • node: T

    Returns boolean

getAdjacentNodes

  • getAdjacentNodes(node: T): Set<T>
  • Returns the adjacent dependent nodes.

    Parameters

    • node: T

    Returns Set<T>

getDependents

  • getDependents(node: T, shallow?: boolean): Iterable<T>
  • Returns an iterator to the dependents of the node.

    Parameters

    • node: T
    • Default value shallow: boolean = false

    Returns Iterable<T>

getNodes

  • getNodes(): Iterable<T>
  • Returns the nodes within this dependency graph.

    Returns Iterable<T>

getTopologicalSort

  • Returns a topological sort of this dependency

    Returns LinkedList<T>

hasDependents

  • hasDependents(node: T): boolean
  • Returns true if a node has dependents.

    Parameters

    • node: T

    Returns boolean

remove

  • remove(node: T): void
  • Removes the node from the dependency graph. If the node does not exist does nothing.

    Parameters

    • node: T

    Returns void

size

  • size(): number
  • Returns the number of vertices in the dependency graph.

    Returns number

toString

  • toString(): string
  • Returns a string representation of this dependency graph.

    Returns string

Static Generate

  • Generates a DependenyGraph object from a string representation.

    Parameters

    • str: string

    Returns DependencyGraph<string>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • 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