I am not good enough in computer science. My intention is to solve some programming problem in terms of DAG's. The key point is that before getting them into database, I need run "topological sort" in order to guarantee an absence of cycles.
Hence, my questions: 1) Does any DAG can be topologically sorted? Is that a theorem? If yes, what's a common name for that? 2) Could any non-DAG be topological sorted as well? Can't I get into trouble relying only on such a sorting? If yes, then what is a better way to a) ensure there are no cycles at all, b) build a proper "string" such that for any pair of verticies A, B either A < B or B < A?