Let's say we have a graph depicted by two objects:
nodes: an array of objects that, at least, have anidproperty eachedges: an array of objects that, at least, have bothstart_id,end_idproperties each
Regardless the properties actual names, it's the meaning what matters.
For simplicity's sake, let's define our edges as an array of arrays like [start_id, end_id] and the result as an array of arrays of node's ids, being each array a component.