As per answer to this question we can use Topological sort to get the ordering of nodes. How do we persist or serialize the edges between nodes? If I need to send the serialized 'directed' graph over network and recreate it on other end, what will I need to send?
Asked
Active
Viewed 518 times
0
-
why do you need to order the vertices to serialize the graph? There are plenty of graph formats out there, but a simple one would just be the edge list. Depends on what kinds of graphs you are sending over the network... – gilleain Jul 28 '17 at 17:10
-
I was planning to do this without using any in-built library. I'll update the question to say Directed Graph. That will explain why I need ordering. – Scooby Jul 28 '17 at 17:47
-
1@Scooby The same comment stands. Just send the list of nodes and edges in any format. It is simple, straightforward, and handles any digraph. Including ones with loops that can't be topologically sorted. Asking about topological sort makes this an X-Y problem, with X being graph serialization and Y being "how does sorting the graph help me". – btilly Jul 28 '17 at 18:51