You don't need a graph database: Modeling graphs and trees in Postgres
linkedin.comWhile there are dedicated graph databases, like Neo4j, PostgreSQL might be all you need. Keep your production system complexity low.
The article shows how to write Postgres queries that: * Traverse a graph. * Detect cycles. * Find the shortest path.