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:

dag single-source

becomes (a (b c)) (e f g).

the problem general dags may have repeat same node more once:

dag multiple sources

will become (a (b c)) (e (b c) f g), , when reconstruct graph, may get:

reconstructed dag

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

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -