BFS returns void if search not successful

return true if search has found the node
return false if search is aborted before finding anything
returns void/undefined if search should continue
therefore return type is a union type of `=> boolean | void`
This commit is contained in:
Sebastian Kropp 2018-08-07 12:25:48 -04:00 committed by GitHub
parent 1151563af9
commit c7e213857e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2819,13 +2819,13 @@ declare namespace cytoscape {
/**
* The handler returns true when it finds the desired node, and it returns false to cancel the search.
* i - The index indicating this node is the ith visited node.
* depth - How many edge hops away this node is from the root nodes.
* v - The current node.
* e - The edge connecting the previous node to the current node.
* u - The previous node.
* i - The index indicating this node is the ith visited node.
* depth - How many edge hops away this node is from the root nodes.
*/
type SearchVisitFunction = (i: number, depth: number, v: NodeCollection, e: EdgeCollection, u: NodeCollection) => boolean;
type SearchVisitFunction = (v: NodeCollection, e: EdgeCollection, u: NodeCollection, i: number, depth: number) => boolean | void;
interface SearchFirstOptions {
/**
* The root nodes (selector or collection) to start the search from.