views:

36

answers:

1

What would be the best way to visualize DAG's nodes and edges in a text form/file? The node can be referred by its name.

A: 

A good way that always worked fine for me is this:

In the first line put all node names (maybe also the total number of nodes). After that, at each line put first the node name and then all nodes the current node has a directed edge.

Example:

A B C D
A B C
B A D
C D
D A

That works of course if all edge weights are equal (or none exist). If you also want to use weights, one possible solution would be like this:

Example:

A B C D
A B(3) C(4)
etc
George B.