小型但可扩展的寻路库

pypaths的Python项目详细描述


pypaths是一个小库,可用于计算内存中简单图的路径。使用pip安装即可试用:

> pip install pypaths

或者,也可以从源安装:

> git clone https://github.com/jonathanhood/pypaths.git
> cd pypaths
> python setup.py install

对于最简单的默认情况,用法非常简单:

frompypathsimportastarfinder=astar.pathfinder()printfinder((0,0),(2,2))

我们还可以提供一些参数来帮助算法理解您的特定图形:

frompypathsimportastarfinder=astar.pathfinder(distance=my_distance_function,# Calculate the absolute distance between two nodescost=my_cost_function,# Calculate the heuristic cost between nodesneighbors=my_neighbors_function)# Calculate the list of neighbors for a given nodeprintfinder("MY NODE 1","MY NODE 3")

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
用户界面如何在JavaGUI中为按钮创建各种颜色?   使用MSCAPI的RSA密钥包装的java使用   java Spring数据Redis JedisConnectionException:意外的流结束   java饼图未显示预期输出   java hystrixCommand注释commandKey的用途是什么   windows java可以从cmd运行jar,但不能通过双击来运行   java在单击按钮时遍历XML节点   java试图使用日期(int,int,int)构造函数   带有Buildship 2子项目的java不作为项目依赖项链接   java jsonrpc4j:如何从服务器获取列表<SomeObject>?   用于Java应用程序的内存设置MaxDirectMemory和MaxHeapMemory   java如何从以下类型格式化日期   javayoutube。搜索列表搜索不返回任何内容   java My参数在方法中不起作用,因为泛型存在问题   java如何将Map<Key1Type,Val1Type>转换为Map<Key1Type,Val2Type>   JavaJUnit测试:测试用例的改进,测试数组列表的长度?   java如何在Android中解析带有属性值的xml数据?   使用Hibernate对枚举类型进行Java8bean验证