关于使用 Cypher 在 Neo4j 上提取组件大小或社区大小的指针?
Pointers on extracting the Component size or Community Size on Neo4j using Cypher?
我正在尝试使用我的 neo4j 数据库提取 Component/Community 大小。有人可以分享任何指向内置函数或 Cypher 命令序列的指针吗,我可以使用它们来提取 Component/Community 大小?
您可以试用 neo4j graph algorithms 插件,它包含可以使用密码调用的算法。您只需下载并复制到 /plugins
文件夹。
它们支持(弱)连通分量。检查 documentation:
获取连通分量的大小。
CALL algo.unionFind.stream('User', 'FRIEND', {})
YIELD nodeId,setId
RETURN distinct(setId) as component, count(*) as component_size
您可以查看强连通分量的数量,docs:
示例:
CALL algo.scc('User','FOLLOW', {write:true,partitionProperty:'partition'})
YIELD loadMillis, computeMillis, writeMillis, setCount, maxSetSize, minSetSize
然后搜索结果:
MATCH (u:User)
RETURN distinct(u.partition) as partition,count(*) as size_of_partition
ORDER by size_of_partition DESC LIMIT 20
它们还支持标签传播算法、docs。
调用示例:
CALL algo.labelPropagation(label:String, relationship:String,
direction:String, {iterations:1,
weightProperty:'weight', partitionProperty:'partition', write:true})
YIELD nodes, iterations, loadMillis, computeMillis, writeMillis, write, weightProperty
我正在尝试使用我的 neo4j 数据库提取 Component/Community 大小。有人可以分享任何指向内置函数或 Cypher 命令序列的指针吗,我可以使用它们来提取 Component/Community 大小?
您可以试用 neo4j graph algorithms 插件,它包含可以使用密码调用的算法。您只需下载并复制到 /plugins
文件夹。
它们支持(弱)连通分量。检查 documentation:
获取连通分量的大小。
CALL algo.unionFind.stream('User', 'FRIEND', {})
YIELD nodeId,setId
RETURN distinct(setId) as component, count(*) as component_size
您可以查看强连通分量的数量,docs:
示例:
CALL algo.scc('User','FOLLOW', {write:true,partitionProperty:'partition'})
YIELD loadMillis, computeMillis, writeMillis, setCount, maxSetSize, minSetSize
然后搜索结果:
MATCH (u:User)
RETURN distinct(u.partition) as partition,count(*) as size_of_partition
ORDER by size_of_partition DESC LIMIT 20
它们还支持标签传播算法、docs。
调用示例:
CALL algo.labelPropagation(label:String, relationship:String,
direction:String, {iterations:1,
weightProperty:'weight', partitionProperty:'partition', write:true})
YIELD nodes, iterations, loadMillis, computeMillis, writeMillis, write, weightProperty