I am building a "self-contained" set of definitions, and would like to ensure that the definitions:

  1. Do not contain circular definitions (which might include other words within that cycle, not just a direct cycle)
  2. Are properly ordered (definitions requiring a word show up after that word has already been defined)

How can I detect cycles, and also determine the ordering of the defintions?

I would assume that dictionaries already employ some kind of tool(s) to accomplish this, but have been unable to find anything. Suggestions on how these things might be accomplished?

  • 1
    You are essentially asking for two graph algorithms - this is not specific to linguistics. Try Computer Science if you want to understand the algorithm itself. If you're looking for tools that do this I'm not sure how to help you.
    – Keelan
    Apr 21, 2020 at 10:03
  • 1
    Surely if a word is defined in terms of other words, the definition will always turn out to be circular within some cycle. Also, dictionaries aren't really ordered, are they? I mean I know the definitions are alphabetical, but there's no expectation that users will read them in that order - it's just done so you can find your way around.
    – rchivers
    Apr 21, 2020 at 11:59

1 Answer 1


As Keelan points out, the properties you're looking for can be provided by cycle detection and topological sorting algorithms, respectively.

As an aside: I don't know of any dictionary that tries to ensure either property. It is generally not seen as an issue by lexicographers if definitions are circular. The closest thing I've seen is a toy dictionary made for English using the Natural Semantic Metalanguage developed by semanticists.

  • 1
    Not a dictionary of course, but Wittgenstein's Tractatus Logico-Philosophicus comes to mind as another example of a text in which ordering has been taken beyond usefulness.
    – Keelan
    Apr 21, 2020 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.