0
我想使用我的neo4j數據庫提取組件/社區大小。有人可能會分享任何指向內置函數或Cypher命令的序列,我可以使用它們提取組件/社區大小嗎?使用Cypher在Neo4j上提取組件大小或社區大小的指針?
我想使用我的neo4j數據庫提取組件/社區大小。有人可能會分享任何指向內置函數或Cypher命令的序列,我可以使用它們提取組件/社區大小嗎?使用Cypher在Neo4j上提取組件大小或社區大小的指針?
您可以試用包含算法的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
感謝您的響應。但是還有一個問題是,當我們說USER或FRIEND時它代表了什麼?看起來像這些查詢運行在任何圖形數據庫上。 – user8494391
檢查文檔...我們通過標籤和關係按類型加載節點 –