Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-10-2020 03:19 AM
here is my scenario
I have specific node label named C . some of this this has multiple edges of same relationship "HAS_DEVICE" with specific node node D. so far I have tried variable length but counting those nodes is taking so much time . here is my query
Match(n:C)-[r:HAS_DEVICE*2..10]-(d:D) return count(n.IDENTITYID),d.DEVICEID as deviceid;
the query is taking huge time . My graph has 10,448,975 nodes and 11,038,864 relationship. I have put identityid as constraints . Is there any wrong of my code or am I something missing here. Kindly help me out
I was expecting output like this
n.Identityid. d.deviceid
3. xyzzy
2. fdfda
11-10-2020 03:25 AM
11-10-2020 03:27 AM
oh hello @Cobra cobra cause I have same relationship has_device more than 2 edges so I have put a range here .
11-10-2020 03:30 AM
I think there is a misunderstanding, you have to use jumps when you want a path with depth. It's not your case.
You should have a look at this topic to count relations:
Regards,
Cobra
11-10-2020 03:35 AM
I am checking it :). but the variable length query gave me the actual picture of nodes which are connected with same relationship multiple times with other specific node. Actually I was happy with that but counting these nodes seems cumbersome to me any way checking your solution. I have got reply after a long time from you 🙂
11-10-2020 03:40 AM
This query should solve your problem?
MATCH (n:C)-[r:HAS_DEVICE]->(d:D)
RETURN d.DEVICEID AS deviceid, count(n.IDENTITYID) AS total
11-10-2020 03:49 AM
@cobra I wanted to filter those nodes which have same relationship>=2 with d nodes. I tried this query before post but it shows unfiltered report.
like
deviceid. identityid
ererere. 1
11-10-2020 04:16 AM
here I one of your solution is similar to me
here in your problem NEXT relationship is directed to multiple times in some specific node from other node . that specific node is my d node and others nodes are my C nodes, I wanted to count C nodes
11-10-2020 05:02 AM
You have depth in your database?
Do you have?
(A)->(B)->(C)
Or
(A)->(C)
(B)->(C)
Your first post show looks like the second option.
Regards,
Cobra
11-10-2020 05:05 AM
Ok I am giving you screen shot what I am getting after
match(n:CUSTOMER)-[r:HAS_DEVICE*2..10]-(d:DEVICE) return n,r,d
so here I can limit my range in number. the brown nodes are device and red nodes are customer so I am trying to find out count of customers which are using same device with HAS_DEVICE relationship . you see there is many customer who are using same device. **I am wanting the direct 1 hop customers count from single devices those have >= 2 edges with customer **
11-10-2020 05:06 AM
Could you create a dummy example I can work on?
11-14-2020 10:17 PM
@cobra I have managed a solution . I have counted all customer nodes which are connected with each device then export it as csv. After that I ran a python script to filter most connected customer with single device . It worked :). Thank you for your help
All the sessions of the conference are now available online