( graph: Graph<N, E, T> | MutableGraph<N, E, T>, predicate: (data: E, source: NodeIndex, target: NodeIndex) => boolean )
| 690 | * @category getters |
| 691 | */ |
| 692 | export const findEdges = <N, E, T extends Kind = "directed">( |
| 693 | graph: Graph<N, E, T> | MutableGraph<N, E, T>, |
| 694 | predicate: (data: E, source: NodeIndex, target: NodeIndex) => boolean |
| 695 | ): Array<EdgeIndex> => { |
| 696 | const results: Array<EdgeIndex> = [] |
| 697 | for (const [edgeIndex, edgeData] of graph.edges) { |
| 698 | if (predicate(edgeData.data, edgeData.source, edgeData.target)) { |
| 699 | results.push(edgeIndex) |
| 700 | } |
| 701 | } |
| 702 | return results |
| 703 | } |
| 704 | |
| 705 | /** |
| 706 | * Updates a single node's data by applying a transformation function. |
nothing calls this directly
no test coverage detected