3
我正在使用neo4j,存儲一個簡單的「content has-many tags」數據結構。 我想知道「哪些標籤與其他標籤共存最多?」如何計算標籤到標籤的關係而不會爆炸?
我已經有了大約500K的內容到標籤的關係,所以不幸的是,這可以解決0.5M^2可能的共存關係,然後你需要計算每種關係發生的次數!或者你呢?我做這個很長的路嗎?
它似乎永遠不會回來,我的CPU現在已經掛了很長一段時間了。
final ExecutionResult result = engine.execute(
"START metag=node(*)\n"
+ "MATCH metag<-[:HAS_TAG]-content-[:HAS_TAG]->othertag\n"
+ "WHERE metag.name>othertag.name\n"
+ "RETURN metag.name, othertag.name, count(content)\n"
+ "ORDER BY count(content) DESC");
for (Map<String, Object> row : result) {
System.out.println(row.get("metag.name") + "\t" + row.get("othertag.name") + "\t" + row.get("count(content)"));
}