GraphIteratorDFS
Guide: /guide/algorithms/graph/iterator-dfs
Signature
const iterator = new GraphIteratorDFS(graph);
Params:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| graph | IGraph<T> | + | Given graph |
Returns:
IGraphIterator<T>
Iterator methods:
initIterator(from: T): void
Init iterator by passing 'from' vertex
Params:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| from | T | + | Start vertex |
Throws IsNotFoundException when there is no next element
next(): T
Iterate to next element (depends on iteration strategy)
Throws IllegalStateException when there is no next element
current(): T
Get current element
Throws IllegalStateException when there is no current element
hasNext(): boolean
Check is there next element available
getPath(from: T, to: T): Array<T>
Get full path between two given vertices
Params:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| from | T | + | Start vertex | |
| to | T | + | End vertex |