cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 1: replicate users.

Setting max number of connections to a node

Hi!
I'm new here and in Neo4j development. I would like to integrate neo4j with a Java server application but the thing is, considering a node (:User) I would like to define a max number of connections to it. For example, a node User can connect with 6 other nodes, no more.

I would like to know if is possible to do using cypher language or I will have to let this logic to Java.

Thanks!

3 REPLIES 3

tard_gabriel
Ninja
Ninja

I cannot confirm it,

But I know really well my Cypher, having taking courses and read almost if not all the Cypher manuel. I never saw such thing explicitly available in the Cypher language.

The reason why I believe it's not available at the Neo4j level it's because of the way Neo4j works behind the scene, and by scene I mean Cypher. I did some query tuning, an advanced topic of queries to learn what's behind Cypher and none of the 90 operators who runs behind Cypher would make sens if you were limiting the number of relations a node can have.

So yes I think you can already start thinking about it at the java application level if you really need to do this. I would be curious to know why you want to introduce such limitation?

Hope it helped a bit

sameer_gijare14
Graph Buddy

Hi Claudio

Please have a look at weakly connected component algorithm(GDS) . That will tell you more about a maximum number of inbound connections a node can accept.

Thanking you
Sameer G

Bennu
Graph Fellow

Hi @claudio.g.chepa!

Usually, this kind of logic (business) must be implemented as part the validator of your service Java Side. You can easily handle it from there as part of your Crud api.

If you really want to implement it on the DB so you have no problems with vendor lock, you cah take a look on

Bennu