Great chapter from the unmissable book by Peter Brawley and Arthur Fuller … … Thank you boys!

Most non-trivial data is hierarchical. Customers have orders, which have line items, which refer to products, which have prices. Population samples have subjects, who take tests, which give results, which have sub-results and norms. Web sites have pages, which have links, which collect hits, which distribute across dates and times. With such data, we know the depth of the hierarchy before we sit down to write a query. The depth of the hierarchy of tables fixes the number of JOINs we need to write.
But if our data describes a family tree, or a browsing history, or a bill of materials, hierarchical depth depends on the data. We no longer know how many JOINs it will take to walk the tree. We need a different data model.
That model is the graph (Fig 1), which is a set of nodes (vertices) and the edges (lines or arcs) that connect them. This chapter is about how to model and query graphs in a MySQL database.
Graph theory is a branch of topology. It is the study of geometric relations which aren’t changed by stretching and compression—rubber sheet geometry, some call it. Graph theory is ideal for modelling hierarchies—like family trees, browsing histories, search trees and bills of materials—whose shape and size we can’t know in advance.

>> Go to Source Article