优化连接查询,在向非循环图

编程入门 行业动态 更新时间:2024-10-24 03:25:48
本文介绍了优化连接查询,在向非循环图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是我的工作对个人的项目之一。我有N个节点(比如亿美元),我会在查询两个节点连接的DAG [isConnected(A,B}。我会查询DAG在线M(比如亿美元)次。有没有办法来优化流程?

This is one of the personal projects that I am working on. I have a DAG of N nodes ( say million ) that I will querying for connectivity of two nodes [ isConnected(a,b} ]. I will be querying the DAG online M ( say million ) times. Is there a way to optimize the process?

下面是我能想出的最好的办法。

Here are the best approaches that I could come up with.

BFS = O(M * N)

BFS = O( M * N )

Dijkstra算法= O(M * E *日志N),其中E为图中的边数。

Dijkstra = O( M* E* log N) where E is the number of edges in the graph.

是否有这个过程的任何其他更好的方法?我现在使用的第二个策略。这需要永远留在我的系统。

Is there any other better approach for this process ? I am right now using the second strategy. This takes forever in my system.

推荐答案

可以计算出传递闭包的DAG,然后回答在固定时间内的查询。然而,这需要高达O(n³)时间和O(N²)内存。有迹象表明,接受较长的查询时间更快preprocessing或更低的内存使用的一些方法,如见这presentation 。

You can calculate the transitive closure of the DAG and then answer the queries in constant time. However, this requires up to O(n³) time and O(n²) memory. There are some methods that accept longer query times for faster preprocessing or lower memory use, see e.g. this presentation.

更多推荐

优化连接查询,在向非循环图

本文发布于:2023-11-30 20:15:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651350.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!