algorithm - Linearizing a DAG with multiple sources -
i looking @ algorithms book, , see there simple algorithm linearize single source, directed acyclic graph deleting source nodes 1 one. can give me example why not work multiple sources?
i assume "linearize" mean converting graph sequence of nodes one-to-one mapping, such full graph can recovered.
a single-source dag directed forest. can linearize it, example, pre-order traversal, tree, starting each root sequentially.
for example, graph:
becomes (a (b c)) (e f g)
.
the problem general dags may have repeat same node more once:
will become (a (b c)) (e (b c) f g)
, , when reconstruct graph, may get:
unless handle duplicates specifically. linearize (a (b c)) (e b f g)
, solve problem remembering nodes reconstructed, though.
anyway, suppose using node deletion algorithm, remove b
here on first encounter, won't able reach e
, , you'll (a (b c)) (e f g)
wrong.
Comments
Post a Comment