How to load a huge graph into memory to repeatedly find shortest path between two given nodes?
I am writing an application in which I need to load a huge graph into memory and answer "shortest path between x and y" for different pairs of x and y. The graph is static and can be loaded once for all into main memory.
The query for shortest path between x and y is made by a UI written in PHP. How can I keep the graph loaded in memory and find the shortest path repeatedly in an efficient way ? Is writing a JA开发者_如何学CVA daemon going to help ?
Sounds like you want to write a service/daemon which run all the time and keeps the data in memory. By huge, how big is it?
You can use memcached to keep the graph loaded in memory. PHP can easily read/write data from memcached.
You would need to run memcached as a daemon / service on server.
精彩评论