Can I perform topological sorting on cycle graph?

2.3k Views Asked by At

I am told to perform a attempted topological sorting on cycle graph (non acyclic). Can I do so? Since a topological sorting only can be perform on a dag(directed acyclic graph).

Click here to view the question with the graph

1

There are 1 best solutions below

0
On

I have created a cyclic-toposort project that aims to sort directed cyclic graphs by determining the least amount of cyclic edges that would result in a sortable directed acyclic graph. I published the cyclic_toposort project on github. It not only quickly sorts a directed cyclic graph providing the minimal amount of violating edges but also optionally provides the maximum groupings of nodes that are on the same topological level (and can therefore be activated at the same time) if desired.

If the problem is still relevant to you then I would be happy if you check out my project and let me know what you think!

This project was useful to my own neural network topology research, so I had to create something like this anyway. I am answering your question this late in case anyone else stumbles upon this thread in search for the same question.