Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-20-2020 11:05 AM
Hello,
I have this query
CALL gds.alpha.scc.stream({
nodeQuery: 'MATCH (Compartment{dbId:74700})<-[:compartment]-
(rle:Reaction{speciesName:"Homo sapiens"})-[:input]->
(pe:PhysicalEntity{speciesName:"Homo sapiens"}) return id(rle) AS id UNION MATCH
(Compartment{dbId:74700})<-[:compartment]-(rle:Reaction{speciesName:"Homo
sapiens"})-[:input]->(pe:PhysicalEntity{speciesName:"Homo sapiens"}) RETURN id(pe)
AS id',
relationshipQuery: 'MATCH (Compartment{dbId:74700})<-[:compartment]-
(rle:Reaction{speciesName:"Homo sapiens"})-[i:input]->
(pe:PhysicalEntity{speciesName:"Homo sapiens",stId:"R-HSA-9610136"})-
[:compartment]->(Compartment{dbId:74700}) RETURN id(rle) AS source, id(pe) AS
target' })
YIELD nodeId, componentId
RETURN gds.util.asNode(nodeId) AS Name, componentId AS Component
I would like to use the scc algorithm.
My problem is That I want to display only the nodes that have an 'input' relationship.
Currently this query shows me all the relationships of the various nodes.
You can help me?
Thanks
Solved! Go to Solution.
11-24-2020 01:35 AM
At first sight, I can see different SCC. When a path exists in both directions for each pair of nodes then the pair will be in the same connected component. In your image, I can see different subgraphs where nodes have paths connecting them in both directions.
11-23-2020 04:01 AM
Hi Daniela,
for what I'm seeing you're just returning the name of the node and the id of the connected component the node belongs to. If you want to show the input
relationships you have at least do something like that:
CALL gds.alpha.scc.stream({
nodeQuery: 'MATCH (Compartment{dbId:74700})<-[:compartment]-
(rle:Reaction{speciesName:"Homo sapiens"})-[:input]->
(pe:PhysicalEntity{speciesName:"Homo sapiens"}) return id(rle) AS id UNION MATCH
(Compartment{dbId:74700})<-[:compartment]-(rle:Reaction{speciesName:"Homo
sapiens"})-[:input]->(pe:PhysicalEntity{speciesName:"Homo sapiens"}) RETURN id(pe)
AS id',
relationshipQuery: 'MATCH (Compartment{dbId:74700})<-[:compartment]-
(rle:Reaction{speciesName:"Homo sapiens"})-[i:input]->
(pe:PhysicalEntity{speciesName:"Homo sapiens",stId:"R-HSA-9610136"})-
[:compartment]->(Compartment{dbId:74700}) RETURN id(rle) AS source, id(pe) AS
target' })
YIELD nodeId, componentId
WITH nodeId
MATCH p = (pe:PhysicalEntity)<-[:input]-()
WHERE id(pe) = nodeId
RETURN p
But of course, you need a way to distinguish your components when you visualize them. So maybe using Bloom can help you with this task.
I'm not sure this will answer your question.
What I can add is that probably in your nodeQuery you're doing the same query twice and you don't need to do a "union". The second query also extracts the nodes of the first one.
11-23-2020 12:00 PM
I changed the query but I don't get a strongly connected components
I get it
11-24-2020 01:35 AM
At first sight, I can see different SCC. When a path exists in both directions for each pair of nodes then the pair will be in the same connected component. In your image, I can see different subgraphs where nodes have paths connecting them in both directions.
11-18-2022 06:41 AM
Dear all,
I am using Neo4j Desktop, Graph Data Science Library 2.2.3, and Neo4j Server 4.4.14.
I am wondering whether the interface of
gds.alpha.scc.stream
is changed?
Since when I try the queries in this discussion, I get
Type mismatch: expected String but was Map (line 2, column 27 (offset: 39))
" CALL gds.alpha.scc.stream({"
^}
Thanks in advance for your answer!
Pierre
11-20-2022 03:17 AM
11-21-2022 03:42 AM
Dear Cobra,
I really need strongly connected and not weakly connected components.
I solved it by first creating a subgraph (using gds.graph.project[.cypher]),
then calling the current scc function on that subgraph,
and finaly droppping the subgraph (using gds.graph.drop).
Greetings,
Pierre
All the sessions of the conference are now available online