SubGraph Serialisation

I am working through your samples. In subgraph how would you store to xml a graph with a subgraph ?
I want to save the links as

but if the link is from a node to a node in the subgraph using
GoPort p = (GoPort)l.FromPort.GoObject;
p is null if the object is in a subgraph

Links are attached to ports, not directly to nodes.
So if you are storing references (such as PartID) of the link’s FromPort and ToPort, you should be finding ports when reconstituting the references.
In the simpler case where there’s only one port on a node, you could use either PartID, as long as you do so consistently. But the general case can have more than one port on a node, so for links it’s generally wiser to reference ports rather than nodes.

Could you please post sample on this case?

After a bit of a think about the problem and looking at more examples I realised that what I needed was to create a collection of all the nodes including those in subgraphs (recursively)
And after an hour of coding success!
This is a brilliant product (should be buying it soon)