Flat files and relational databases give us a mechanism to serialize structured data. XML is superb for serializing un-structured tree-like data.
But many problems are b
How do you represent your graph in memory?
Basically you have two (good) options:
in which the adjacency list representation is best used for a sparse graph, and a matrix representation for the dense graphs.
If you used suchs representations then you could serialize those representations instead.
If it has to be human readable you could still opt for creating your own serialization algorithm. For example you could write down the matrix representation like you would do with any "normal" matrix: just print out the columns and rows, and all the data in it like so:
1 2 3
1 #t #f #f
2 #f #f #t
3 #f #t #f
(this is a non-optimized, non weighted representation, but can be used for directed graphs)