3 ms·
this code does not work. it tests if the graph is a tree, not a directed acyclic graph.
by hc 18y ago
this code does not work. it tests if the graph is a tree, not a directed acyclic graph.
- SapphireSun 18y agoYou're right. Now that I think about it. Someone else mentioned that it doesn't test for unconnected nodes, or nodes connected only via back links. However, figuring out how to find them will depend heavily on your implementation.
- SapphireSun 18y agoYou're right. Now that I think about it. Someone else mentioned that it doesn't test for unconnected nodes, or nodes connected only via back links. However, figuring out how to find them will depend heavily on your implementation. Most likely you store all of them in an array and perform the search on each of them. I wish I could find my data structures and algorithms textbook. I lent it out and I really wish I still had it...