2017-09-04 52 views

回答

0

您可以試用包含算法的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 
+0

感謝您的響應。但是還有一個問題是,當我們說USER或FRIEND時它代表了什麼?看起來像這些查詢運行在任何圖形數據庫上。 – user8494391

+0

檢查文檔...我們通過標籤和關係按類型加載節點 –