Optimization Newbie Questions

I'm working on developing a network graph that we're loading in neo4j. I'm still at a prototyping stage and trying to figure out a few queries.

So one of the asks would be to get a list of all nodes connected to a particular device or later one, what is affected if a link is disconnected.

This is what I'm running to get a list of attached devices:

match (n:Resource)-[*..15]->(m:ns1__NetworkAddress) where id(n) = 71 return m.ns1__value, id(m)

That gives me list of all node IDs and IPs that are attached to node 71. When I use [*..10] that seems to work, but if I leave it unbound or even bound it to 15 it never returns.

Is there an equivalent of a SQL explain that I could use? Or should I be adding constraints or indeces to optimize this type of query?

It feels like asking for all nodes attach to X should be a pretty basic ask and I'm not even loading THAT much data. There's about 1500 nodes that I'm working with. Relative to say FB or other data set this is dismal.

Side note: Any recommended reading to better understand how to model data, structure data etc.

Profile of query attached.

Hello @csgeek3674 and welcome to the Neo4j community :slight_smile:

With this query, you should get a list of all ns1__NetworkAddress nodes from 0 to 15 depth.

MATCH path = (n:Resource)-[*..15]->(m:ns1__NetworkAddress) 
WHERE id(n) = 71 
RETURN [node IN nodes(path) | CASE WHEN node:ns1__NetworkAddress THEN {ns1__value: node.ns1__value, id: id(node)} END]

I advice you to use apoc.path.expandConfig() function from APOC plugin for what you try to achieve.