Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • Graph

Index

Constructors

constructor

  • Parameters

    • Default value opts: GraphOptions = {}

      GraphOptions opts.directed boolean opts.multigraph boolean opts.compound boolean

    Returns Graph

Properties

Private _children

_children: Map<N, Set<N>>

Private _edgeObjs

_edgeObjs: Map<E, Edge>

Private _edges

_edges: Map<E, any>

Private _inEdges

_inEdges: Map<N, Map<E, Edge>>

Private _isCompound

_isCompound: boolean

True if the graph is compound e.g. when there are parent-child relationship between nodes

default

false

Private _isDirected

_isDirected: boolean

True if the graph is directed, see http://mathworld.wolfram.com/DirectedGraph.html

default

true

Private _isMultigraph

_isMultigraph: boolean

True if the graph is a multigraph, see http://mathworld.wolfram.com/Multigraph.html

default

false

Private _listeners

_listeners: Map<string, Set<function>>

Private _nodes

_nodes: Map<N, any>

Private _outEdges

_outEdges: Map<N, Map<E, Edge>>

Private _parent

_parent: Map<N, N>

Private _predecessors

_predecessors: Map<N, Map<N, number>>

Private _successors

_successors: Map<N, Map<N, number>>

Static prefixed

prefixed: string | boolean

Methods

addListener

  • addListener(event: string | symbol, fn: ListenerFn, context?: any): this
  • Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns this

children

  • children(node?: N): IterableIterator<N>
  • Parameters

    • Default value node: N = GRAPH_NODE

    Returns IterableIterator<N>

edge

  • edge(...args: Array<any>): E
  • Parameters

    • Rest ...args: Array<any>

    Returns E

edgeCount

  • edgeCount(): number

edges

  • edges(): IterableIterator<Edge>

emit

  • emit(event: string | symbol, ...args: Array<any>): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol
    • Rest ...args: Array<any>

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Return an array listing the events for which the emitter has registered listeners.

    Returns Array<string | symbol>

hasEdge

  • hasEdge(...args: Array<any>): boolean
  • Parameters

    • Rest ...args: Array<any>

    Returns boolean

hasNode

  • hasNode(node: N): boolean

inEdges

  • inEdges(v: N, u?: N): IterableIterator<Edge>

isCompound

  • isCompound(): boolean

isDirected

  • isDirected(): boolean

isLeaf

  • isLeaf(node: N): boolean

isMultigraph

  • isMultigraph(): boolean

listeners

  • listeners(event: string | symbol, exists: boolean): Array<ListenerFn> | boolean
  • listeners(event: string | symbol): Array<ListenerFn>
  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol
    • exists: boolean

    Returns Array<ListenerFn> | boolean

  • Parameters

    • event: string | symbol

    Returns Array<ListenerFn>

neighbors

  • neighbors(node: N): IterableIterator<N>
  • Parameters

    • node: N

    Returns IterableIterator<N>

node

  • node(node: N): any

nodeCount

  • nodeCount(): number

nodeEdges

  • nodeEdges(v: N, w: N): IterableIterator<Edge>

nodes

  • nodes(): IterableIterator<N>

off

  • off(event: string | symbol, fn?: ListenerFn, context?: any, once?: undefined | true | false): this
  • Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: undefined | true | false

    Returns this

on

  • on(event: string | symbol, fn: ListenerFn, context?: any): this
  • Add a listener for a given event.

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns this

once

  • once(event: string | symbol, fn: ListenerFn, context?: any): this
  • Add a one-time listener for a given event.

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns this

outEdges

  • outEdges(v: N, w?: N): IterableIterator<Edge>

parent

  • parent(node: N): N | undefined

predecessors

  • predecessors(node: N): IterableIterator<N>
  • Parameters

    • node: N

    Returns IterableIterator<N>

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns this

removeEdge

  • removeEdge(...args: Array<any>): Graph

Private removeFromParentsChildList

  • removeFromParentsChildList(node: N): void

removeListener

  • removeListener(event: string | symbol, fn?: ListenerFn, context?: any, once?: undefined | true | false): this
  • Remove the listeners of a given event.

    Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: undefined | true | false

    Returns this

removeNode

  • removeNode(node: N): void

setEdge

  • setEdge(...args: Array<any>): Graph

setNode

  • setNode(node: N, value?: any): Graph

setParent

  • setParent(node: N, parent?: N): Graph

setPath

  • setPath(path: Array<N>, value?: any): Graph

sinks

  • sinks(): IterableIterator<N>

sources

  • sources(): IterableIterator<N>

successors

  • successors(node: N): IterableIterator<N>
  • Parameters

    • node: N

    Returns IterableIterator<N>

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