I have just been looking into a similar question, and using parameters you can pass in the node and relationship ids (GDSL docs - projection parameters)
So, a query using the base example from apoc.graph.fromPaths docs would be the following:
MATCH p...