我想找出从goal
到{
我对root
的输入是{'4345092': ['6570646', '40586', '484']}
我对goal
的输入是{'886619': ['GOAL']}
我对path_holder
的输入是一个输入,但它被转换为dct
,并用于此函数。我对while循环感到困惑,因为它为我创建了向后的路径。现在我不能让q
打印,因为这部分代码没有运行。dct
基本上是一个包含循环的有向图表示。我似乎不知道如何从GOAL
开始,到root
节点结束。我想知道是否有人能帮我解决这个问题谢谢!在
dct公司:
dct =
{ '612803266': ['12408765', '46589', '5880', '31848'],
'8140983': ['7922972', '56008'],
'7496838': ['612803266'],
'1558536111': ['7496838'],
'31848': ['DEADEND'],
'1910530': ['8140983'],
'242010': ['58644', '886619'],
'727315568': ['DEADEND'],
'12408765': ['DEADEND'],
'56008': ['DEADEND'],
'58644': ['DEADEND'],
'886619': ['GOAL'],
'40586': ['931', '727315568', '242010', '1910530'],
'5880': ['1558536111'],
'46589': ['DEADEND'],
'6570646': ['2549003','43045', '13830'],
'931': ['299159122'],
'484': ['1311310', '612803266'],
'1311310': ['DEADEND'],
'7922972': ['DEADEND']
}
我的职能:
^{pr2}$
只要找到路径,然后反转它们。在
更新:在结束条件的“死区”和“目标”中添加“[]”。在
相关问题 更多 >
编程相关推荐