File size: 310 Bytes
f909d7c
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import { NodeData, EdgeData } from "src/types/graph";

export const getChildrenEdges = (nodes: NodeData[], edges: EdgeData[]): EdgeData[] => {
  const nodeIds = nodes.map(node => node.id);

  return edges.filter(
    edge => nodeIds.includes(edge.from as string) || nodeIds.includes(edge.to as string)
  );
};