Almost:
5) Pick the object that has a UID passed into the function at index 0 and set the NextUID value to UID of the object instance that was picked. (Consider this the draw-from object).
7) ... (Consider this the draw-to object).
9) Call on the Function again, passing in the draw-from UID, and run it for all other instances of the Family whose NextUIDs are -1 (not used yet).