Skip to content

Latest commit

 

History

History
297 lines (161 loc) · 9.81 KB

File metadata and controls

297 lines (161 loc) · 9.81 KB

dangraph / Exports / directed_graph/danDirectedGraphDepthFirstIterator / DanDirectedGraphDepthFirstIterator

Class: DanDirectedGraphDepthFirstIterator<I, D>

directed_graph/danDirectedGraphDepthFirstIterator.DanDirectedGraphDepthFirstIterator

The class DanDirectedGraphDepthFirstIterator implements GraphIterator interface

Type parameters

Name
I
D

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DanDirectedGraphDepthFirstIterator<I, D>(collection, startingNodeId): DanDirectedGraphDepthFirstIterator<I, D>

The public class constructor

Type parameters

Name
I
D

Parameters

Name Type Description
collection DanDirectedGraph<I, D> the directed graph
startingNodeId I the starting node identifier

Returns

DanDirectedGraphDepthFirstIterator<I, D>

Throws

exception if startingNodeId was not found in graph

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:33

Properties

_currentNodeId

Private _currentNodeId: null | I

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:21


_graph

Private _graph: DanDirectedGraph<I, D>

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:15


_nextNodeId

Private _nextNodeId: null | I

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:23


_stack

Private _stack: DanStack<IterableIterator<[I, DanArc<I, D>]>>

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:25


_startingNodeId

Private _startingNodeId: I

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:19


_visitedNodes

Private _visitedNodes: Set<I>

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:17

Methods

_advance

_advance(): void

Advance to the next node in a depth first fashion

Returns

void

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:111


_getNodeAndDirectedArcsFromNodeId

_getNodeAndDirectedArcsFromNodeId(nodeId): DanNodeAndDirectedArcs<I, D>

Retrieve node and directed arcs structure from node identifier

Parameters

Name Type Description
nodeId I the node identifier

Returns

DanNodeAndDirectedArcs<I, D>

the node and directed arcs structure DanNodeAndDirectedArcs

Throws

exception if nodeId was not found in graph

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:46


_initFields

_initFields(startingNodeId): void

Init the class fields with the starting node identifier passed in input

Parameters

Name Type Description
startingNodeId I the starting node identifier

Returns

void

Throws

exception if startingNodeId was not found in graph

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:59


current

current(): undefined | DanNode<I, D>

Get the current node, or return undefined if iterator was not yet started

Returns

undefined | DanNode<I, D>

Throws

exception if this._currentNodeId was not found in graph

Implementation of

GraphIterator.current

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:78


hasNext

hasNext(): boolean

Check if the iterator can step to a next node

Returns

boolean

true if the iterator can step to a next node, false if there are no more nodes left to visit in the iterator

Implementation of

GraphIterator.hasNext

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:160


next

next(): undefined | DanNode<I, D>

Get the next node, or return undefined if the iterator's end was reached

Returns

undefined | DanNode<I, D>

Throws

exception if this._nextNodeId was not found in graph

Implementation of

GraphIterator.next

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:91


rewind

rewind(): void

Restart the iterator

Returns

void

Implementation of

GraphIterator.rewind

Defined in

src/directed_graph/danDirectedGraphDepthFirstIterator.ts:167