Export to pdf BUT following links

I have not done it before but I would look in org-roam-graph functions to see if you can get a list of IDs or file names. For example, this function looks promising, though I don’t know exactly what edges return:

(defun org-roam-graph--connected-component (id distance)
  "Return the edges for all nodes reachable from/connected to ID.
DISTANCE is the maximum distance away from the root node."

There seem to be some other function or db query snippets that might be useful for your requirement.

Once you have obtained a list of IDs or file names, then it’s a matter of iterating it to call an export function for each file.