The most common place I've encountered recursive CTEs being massively useful in real world work is working with company responsibility & reporting hierarchies (line management, regulatory supervision, "spans of control" reporting, ...) where there is not a fixed number of levels.
When there are a small and fixed number of levels (for instance every drone has a supervisor and senior supervisor and you don't monitor connections above that) there are often other solutions that people find easier to understand and/or perform faster but for deeper trees or those where the level structure is any less static, recursive CTEs are a godsend.
Other examples include nested taxonomies (nature, book or other publication filing, nested tags for categorisation), properly threaded discussion records, family trees (though these are graphs rather than trees unless you impose some strict limits on what you count), representing file-system like structures in the DB, ...
Graphs get tricker (trees are a subset of graphs) as you may need to consider multiple paths to the same node, infinite loops, and other complications, so I suggest looking into trees first then expending your research.
The most common example for graphs in DBs would be a graph representing the friends/contacts of users. It's one of these "you'll know when you need it" solutions.
Sometimes your data structure is a graph, and sometimes you want that graph to live in a database.
And in even rarer cases you want to search that graph in your database in some recursive manner.
The Fossil discussion involves the SCM's representation of a File System, probably the most common hierarchical data structure we regularly encounter. Hierarchical data structures are notoriously hard in SQL. Recursive CTEs are not easy but they are useful and efficient for hierarchical data.
[1] https://www.sqlite.org/draft/lang_with.html#hierarchical_que...
[1] http://dcx.sap.com/1200/en/dbusage/ug-commontblexpr.html
[2] http://dcx.sap.com/1200/en/dbusage/parts-explosion-cte-sqlug...
I was able to make a query like this in PostgreSQL, but forgot the details of how I did it (though once you sit down, you get it eventually).
A graph database usually means you’re storing the graph nodes and edges as entities, so you can traverse the graph easily from any direction, and express different kinds of relationships.
Either way my intention here was to simply provide an example of a real-world recursive CTE use case.