( graph: Graph<N, E, T> | MutableGraph<N, E, T>, predicate: (data: N) => boolean )
| 614 | * @category getters |
| 615 | */ |
| 616 | export const findNodes = <N, E, T extends Kind = "directed">( |
| 617 | graph: Graph<N, E, T> | MutableGraph<N, E, T>, |
| 618 | predicate: (data: N) => boolean |
| 619 | ): Array<NodeIndex> => { |
| 620 | const results: Array<NodeIndex> = [] |
| 621 | for (const [index, data] of graph.nodes) { |
| 622 | if (predicate(data)) { |
| 623 | results.push(index) |
| 624 | } |
| 625 | } |
| 626 | return results |
| 627 | } |
| 628 | |
| 629 | /** |
| 630 | * Finds the first edge that matches the given predicate. |
nothing calls this directly
no test coverage detected
searching dependent graphs…