json / src /lib /utils /graph /getChildrenEdges.ts
xinnni's picture
Upload 146 files
f909d7c verified
raw
history blame contribute delete
310 Bytes
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)
);
};