Answer the question
In order to leave comments, you need to log in
How to work with large graphs?
Hello. I am developing a simple application to find the cheapest flight. I am doing a project for my portfolio. To find the shortest path, I will use Dijkstra's algorithm. Prices - weights in the graph.
Cities and flights are stored in Postgresql. Cities are stored in one table, and direct flights (ribs) with prices are stored in the other. The start and end points are foreign keys to the table with cities, so that it would be impossible to create a flight from cities that do not exist.
The question is how in large systems they solve the problem of loading large data into memory. After all, you need to load all the edges at once in order to then run Dijkstra's algorithm. I can, of course, transfer all calculations to psql so that they are considered in the database, but I don’t really like this solution.
People who know, tell me how to do it right.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question