前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Neo4J:APOC深入

Neo4J:APOC深入

作者头像
程裕强
发布2019-10-24 21:02:39
6460
发布2019-10-24 21:02:39
举报

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://blog.csdn.net/chengyuqiang/article/details/102663149

1、修改配置

代码语言:javascript
复制
[root@elastic1 neo4j-community-3.5.11]# bin/neo4j stop
代码语言:javascript
复制
[root@elastic1 neo4j-community-3.5.11]# vi conf/neo4j.conf
代码语言:javascript
复制
# Whether requests to Neo4j are authenticated.
# To disable authentication, uncomment this line
dbms.security.auth_enabled=true
代码语言:javascript
复制
# A comma separated list of procedures and user defined functions that are allowed
# full access to the database through unsupported/insecure internal APIs.
dbms.security.procedures.unrestricted=apoc.*
代码语言:javascript
复制
# Java Heap Size: by default the Java heap size is dynamically
# calculated based on available system resources.
# Uncomment these lines to set specific initial and maximum
# heap size.
dbms.memory.heap.initial_size=1g
dbms.memory.heap.max_size=2g

# The amount of memory to use for mapping the store files, in bytes (or
# kilobytes with the 'k' suffix, megabytes with 'm' and gigabytes with 'g').
# If Neo4j is running on a dedicated server, then it is generally recommended
# to leave about 2-4 gigabytes for the operating system, give the JVM enough
# heap to hold all your transaction state and query context, and then leave the
# rest for the page cache.
# The default page cache memory assumes the machine is dedicated to running
# Neo4j, and is heuristically set to 50% of RAM minus the max Java heap size.
dbms.memory.pagecache.size=2g

2、随机图生成

代码语言:javascript
复制
CALL apoc.generate.ba(1000,2,'Person','FRIEND_OF')
在这里插入图片描述
在这里插入图片描述
代码语言:javascript
复制
match(p:Person)return p
在这里插入图片描述
在这里插入图片描述

3、PageRank算法

代码语言:javascript
复制
FOREACH(id IN range(0,1000)|CREATE(n:Node{id:id}))
在这里插入图片描述
在这里插入图片描述
代码语言:javascript
复制
MATCH(n1:Node),(n2:Node) WITH n1,n2 LIMIT 1000000 WHERE rand()<0.1 
CREATE (n1)-[:TYPE_1]->(n2)
在这里插入图片描述
在这里插入图片描述
代码语言:javascript
复制
MATCH(node:Node) WITH collect(node) as nodes 
CALL apoc.algo.pageRank(nodes) YIELD node,score 
RETURN node,score ORDER BY score DESC
在这里插入图片描述
在这里插入图片描述
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-10-21 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、修改配置
  • 2、随机图生成
  • 3、PageRank算法
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档