Is this kind of graph possible in Neo4j


How do I create this kind of graph? Most of the graph i see have simple relation between 2 nodes. I don't want to create a different node for interface because 2 different item may have the same interface name but the interface are actually different because they are not from the same item. Each item is unique and each pair of (item,interface) is unique. However, interface itself is not unique.

Thanks in advance.


How about this one.
But I would connect the interface as a node. The node's properties can add index and seem complicated, but the relationship The more of them, the faster the search will be.

CREATE (:Item1 {name:'Item1'})-[:INTERFACE {interface_from:'interface1',interface_to:'interface2'}]->(:Item2 {name:'Item2'})

Thanks for your response :) .

Yes it would seem that creating a different node for interface is much more interesting. But, how do i make sure that even if the interface node has same name, but they are still not the same because they come from different item ?


I think this kind of design is better.
I'm not sure what Item and Interface means.
I imagined it as Device and Port.

Item1 has a Interface1.
Item2 has a Interface1. (Same Interface name )
Item3 has a Interface2.

CREATE (item1:Item {name:'Item1'})-[:HAS]->(int11:Interface {name:'Interface1'}),
       (item2:Item {name:'Item2'})-[:HAS]->(int12:Interface {name:'Interface1'}),
       (item3:Item {name:'Item3'})-[:HAS]->(int2:Interface {name:'Interface2'})
CREATE (int11)-[:CONNECTS]->(int2),

Yes i use this kind of data model now. I add an index to the interface to indicates this interface belongs to which equipment to make sure it is different between different interface but with same name when i use the MERGE in cypher.

Thanks Koji

1 Like

I use this in the model of networking equipment.
Additionally, I use a multi-layered configuration.

That is what I'm trying to do also. Can you elaborate more on the multi-layered configuration ?

Also, do you have a problem with redundancy ?

In the picture, it creates 2 nodes of interface with same name, but it is created twice because the direction is not the same. I import the data from csv file.

Here's an example of how to classify it as a service layer and physical.
This is not a real design, but think of it as a model.
We have two lines as redundancy.