4 ms·
If you store a list of edges like (startId, endId) with an index on startId, then every time you want to follow an edge will cost O(log(n)) where n is the numbe
by henryfjordan 4y ago
If you store a list of edges like (startId, endId) with an index on startId, then every time you want to follow an edge will cost O(log(n)) where n is the number of edges in your graph.
You can get O(1) performance on similar queries using a different storage strategy (by storing edges as pointers to the other nodes in memory) but SQL is not the right tool for that, you would be better off with a true graph DB.