Closed aruig666 closed 3 weeks ago
Hi @aruig666 ,
I have transferred your question to the appropriate repository. Could you please let me know what is the projection query that you have used to create myGraph
?
Best regards, Ioannis.
I uploaded my code and data. You can run the 'processneomodel2.py' file to generate my graph with two json files. The query code is described above. Please help me look at the problem I encountered.
Hi again @aruig666,
Thank you for sharing your data. I have executed the node similarity by projecting everything:
gds.graph.project('mygraph','*','*')
When I executed your query I also did not get any results back. However, by slightly tweaking as follows I could obtain some results back:
CALL gds.nodeSimilarity.stream('mygraph', { topk: 20}) YIELD node1, node2, similarity where gds.util.asNode(node1).name='F1_ROUGHTOPFACE_P1' and gds.util.asNode(node2).name='F2_SPOTDRILL_P1' RETURN gds.util.asNode(node1).name AS Process1, gds.util.asNode(node2).name AS Process2, similarity ORDER BY similarity
"F1_ROUGHTOPFACE_P1" | "F2_SPOTDRILL_P1" | 0.2
"F1_ROUGHTOPFACE_P1" | "F2_SPOTDRILL_P1" | 0.2
What happens is that the nodesimilarity algorithm does not return all results, but rather the top ones (i.e., either the topN
global largest similariities or the topK
closest similarities per node).
In your case, these two similarities are 0.2 and are smaller than others so they gets discarded. To go around this, we must change the configuration similar to how I did. I invite you to have a. look at the relevant section in the documentation.
Let me know if that solves your problem.
Best regards, Ioannis.
I set topk=20 as you said, and the search results are normal now. Thank you very much
Good to hear!
I will close the issue now, please let us know if you need any more help.
Ioannis.
I search for nodes and their adjacent nodes by name, as shown in the code and figure:![Snipaste_2024-05-30_11-57-35](https://github.com/neo4j/neo4j/assets/74703696/8fba3b1b-069c-49d1-842b-6a16b2bb2b9c)
MATCH (n:Operation{name:'F1_ROUGHTOPFACE_P1'})-[:Member|:Use]-(a) MATCH (m:Operation{name:'F2_SPOTDRILL_P1'})-[:Member|:Use]-(b)RETURN n,m,a,b
But when I use gds.nodeSimilarity.stream() to calculate the similarity, the code and the result are as shown:![Snipaste_2024-05-30_12-00-59](https://github.com/neo4j/neo4j/assets/74703696/af201d45-b7a2-4c5e-9935-a46a390e0383)
CALL gds.nodeSimilarity.stream('myGraph') YIELD node1, node2, similarity where gds.util.asNode(node1).name='F1_ROUGHTOPFACE_P1' and and gds.util.asNode(node2).name='F2_SPOTDRILL_P1' RETURN gds.util.asNode(node1).name AS Process1, gds.util.asNode(node2).name AS Process2, similarity ORDER BY similarity
My operating environment is: neo4j-community-5.20.0 Neo4j Graph Data Science Library v2.6.7 Windows 11 Family Chinese Edition v23H2