如何将巨大的图形加载到内存中以重复找到两个给定节点之间的最短路径?

时间:2023-02-01 16:17:58

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.

我正在编写一个应用程序,我需要将一个巨大的图形加载到内存中,并为不同的x和y对回答“x和y之间的最短路径”。该图是静态的,可以一次性加载到主存储器中。

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 JAVA daemon going to help ?

x和y之间的最短路径的查询是由用PHP编写的UI完成的。如何将图形加载到内存中并以有效的方式重复找到最短路径?写一个JAVA守护进程会有帮助吗?

2 个解决方案

#1


0  

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?

听起来你想写一个一直运行的服务/守护进程并将数据保存在内存中。巨大的,有多大?

#2


0  

You can use memcached to keep the graph loaded in memory. PHP can easily read/write data from memcached.

您可以使用memcached将图形加载到内存中。 PHP可以轻松地从memcached读取/写入数据。

You would need to run memcached as a daemon / service on server.

您需要在服务器上运行memcached作为守护程序/服务。

#1


0  

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?

听起来你想写一个一直运行的服务/守护进程并将数据保存在内存中。巨大的,有多大?

#2


0  

You can use memcached to keep the graph loaded in memory. PHP can easily read/write data from memcached.

您可以使用memcached将图形加载到内存中。 PHP可以轻松地从memcached读取/写入数据。

You would need to run memcached as a daemon / service on server.

您需要在服务器上运行memcached作为守护程序/服务。