Relational databases are frequently used to store graphs in all their many flavors (trees, directed graphs, undirected graphs, ...).
Why then do none of the major DBMSs (Microsoft, MySql, Oracle, PostgreSQL, SqlLite, just to name a few in alphabetical order) include library support for treating relations as graphs?
Some desirable features, by way of example:
- Constraint checking (connectedness, acyclicity, planarity, ...)
- Commonly needed functions (shortest path, minimum spanning tree, transitive closure, max flow/min cut, clique detection, Hamiltonian/Eulerian cycles ...)
- Auxiliary data structures needed to improve performance for any of the above
Building support for some of these things outside the database is complicated because (among other reasons):
- It's inherently complicated (libraries help here)
- Short answers are often supported by lots of data: an external client running a shortest path algorithm would need to either be very "chatty" with the database or would need to retrieve a much-larger-than-needed amount of data; either choice is bad for the network
- Maintaining integrity when integrity depends on a graph-theoretic constraint requires access to all proposed updates, hence a trigger, and access to existing graph libraries from triggers is complicated in many systems
- The DBMS storage manager and optimizer are uniquely positioned to address the question of auxiliary data structures, as they do with indexes
This isn't a rhetorical question, I actually want to know if there are interesting technical (or historical) reasons.