GraphIteratorBFS
Guide: /guide/algorithms/graph/iterator-bfs
Signature
const iterator = new GraphIteratorBFS(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 |
IsNotFoundException
when there is no next element
Throws next(): T
Iterate to next element (depends on iteration strategy)
IllegalStateException
when there is no next element
Throws current(): T
Get current element
IllegalStateException
when there is no current element
Throws 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 |