Thank you very much, @Oliver.O!
In my case, I already have a representation where the graph references are specified with ids: it's the "database representation" (used with jOOQ) which is then converted in an actual graph of Kotlin objects before my application does anything with them.
I guess I will just serialize the database representation, for now, for network communication purposes.
In the case that won't be enough... yours is a fine example and I'll copy from that.
Thanks again!