给定有向图G(V,E),我需要找到从i到长度完全为k的任何其他顶点的所有不同路径。
我知道,使用O(K V ^ 3)中的3D表可以找到在2个顶点之间长度为k的所有可能路径,因此我们可以进行V次查找所有所需的路径。但是我想知道这是否可以比O(K V ^ 4)做得更好。
答案 0 :(得分:2)
考虑从节点使用有限的depth-first search,并将搜索深度限制为Lines <- "
Client Qte Montant Date_achat Ville Typologie
1 Cl1 28 2750 2015-05-16 Marseille S7
2 Cl1 27 2570 2015-06-03 Marseille S7
3 Cl1000 24 1950 2015-07-05 Marseille S17
4 Cl1000 17 1400 2016-01-09 Marseille S17
5 Cl104 29 2680 2015-01-02 Grenoble S3
6 Cl110 29 2660 2016-02-02 Calais S2
7 Cl110 29 2660 2015-02-02 Calais S2"
AllInfosClients <- read.table(text = Lines)
。