cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

TO increase the process time of getting data for data mutliple realtionship

i am tagging you the cypher query which i have been using to process the data
"MATCH p=(b:Vendor)-[*0..30]->(child)
where (child:MatPlant or child:Customer) and b.node_id="US1|0010764006"
and NONE( rel in relationships(p) WHERE type(rel)="VendorToVendorPurchaseOrder")
optional match (child)--(wc:WorkCenter)
return p
for this query there are data which are working that is only for small dataset but for large dataset if i use this query the neo4j broswer is not responding and couldnt able to get the graph could you guys help me in optimizing it or get the details for big data

7 REPLIES 7

Hi @saisannihith7419 !

In order to improve performance you may need APOC.

Try something like

MATCH (b:Vendor {node_id : 'US1|0010764006'})
CALL apoc.path.subgraphNodes(b, {
	relationshipFilter: "-VendorToVendorPurchaseOrder",
    minLevel: 0,
    maxLevel: 30,
    labelFilter: 'MatPlant|Customer'
})
YIELD node
optional match p = (child)--(wc:WorkCenter)
return p

I change a bit the nature of p nont knowing why WorkCenter was not used. You can use spanningTree if you are bit more into paths from root.

Bennu

Oh, y’all wanted a twist, ey?

thank you wil try and update

Thanks for the query but I need the flow to start from Vendor Ends at Customer .
vendor-->MatplantS(can be mutliple matplants) ----->Customer

Hi @saisannihith7419

Have you tried something like?

MATCH (b:Vendor {node_id : 'US1|0010764006'})
CALL apoc.path.expandConfig(b, {
	relationshipFilter: "-VendorToVendorPurchaseOrder",
    minLevel: 0,
    maxLevel: 30,
    labelFilter: 'MatPlant|/Customer',
    uniqueness : 'NODE_GLOBAL'
})
YIELD path
return path

Bennu

Oh, y’all wanted a twist, ey?

MATCH (p:Vendor {node_id: "US1|0430095406"})
MATCH (k:Customer)
WITH p,k
CALL apoc.path.spanningTree(p, {
relationshipFilter: "VendorToMatPlant|MfgMatPlant_To_MatPlant|TrfInterCommMatPlant_To_MatPlant|TrfSTOMatPlant_To_MatPlant|SalesMatPLant_To_Customer",
minLevel: 1,
maxLevel: 30,
endNode:k
})
YIELD path
RETURN path;
"This is spanning tree query which i have used

You are executing count(:Customer) queries here. If you now that your end node has a Customer label use the label filter property with /Customer. Take a look into the docs of Apoc.

Bennu

Oh, y’all wanted a twist, ey?

And Also my data is having a large graph depth its a big data please consider that also.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online