Neo4j Desktop 添加算法插件Graph Algorithms

Neo4j提供了强大的算法库,可供我们直接调用,而不需要自己再手动编写。

要使用其自带的算法库,首先需要添加相应插件,下面详细介绍。

1、如下图,进入Neo4j desktop中进入插件管理界面,可以看到部分插件状态,如果有适配的版本可以直接安装即可;

但我本地安装的Neo4j desktop是3.5.12 Enterprise,遇到了如下错误,所以只能手动安装;

 2、手动安装需要先下载对应jar包访问https://github.com/neo4j-contrib/可以看到有很多插件可选,此处我需要安装Graph Algorithms,故进入到https://github.com/neo4j-contrib/neo4j-graph-algorithms/releases下载对应版本(我此处选用的是3.4.12.7);

3、将jar包放置到---installation-3.5.12\plugins目录下;

4、修改配置文件,在dbms.security.procedures.unrestricted配置项末尾增加algo.*;

5、重启服务;

执行CALL dbms.procedures()应该能够看到对应的算法已经能查询到,接着便可以调用算法库中的算法执行运算了。

MATCH (n:Loc {name:"A"}) CALL algo.shortestPath.deltaStepping.stream(n, "cost", 3.0)
YIELD nodeId, distance
MATCH (destination) WHERE id(destination) = nodeId
RETURN destination.name AS destination, distance

发布了123 篇原创文章 · 获赞 12 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/haiziccc/article/details/103768444