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
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.
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.