How to club nodes together and have relationships between such colection of nodes?


(Abrocknrol) #1

I'm interested in storing such graphs (given below) in neo4j where nodes are clubbed together and we can have relationships between these collection of nodes. Is there a way to do this in neo4j?


(Paul Thomas) #2

Yes, no, maybe ...

I have found that figuring out how best to model a dataset as a graph can be a bit of a chicken and egg situation in that, sometimes you need to think ahead regarding the types of queries you want to be able to run ...

What sort of graph queries do you want to be able to run on this dataset?

I would suggest maybe you think along the lines of a node to represent an action (eg a firing) and then link that node to the people involved, the links can of course by different types or have different properties stored on the link. If all the firings are stored this way then your similar links show above are reflected by the node type ...

This would be my starting point and see if it makes sense and if the queries from / into the model etc ...

Are you going to be looking for rings? or chains? or aggregating over multiple events etc ...


(Andrew Bowman) #3

paul.thomas is spot on here, it depends upon the queries you plan to run. Having :Action nodes (that can be multi-labeled if you like) as stand-ins for these kinds of groupings makes sense.

Keep in mind that this type of graph isn't really well modeled as a property graph. For example, you have multiples of the same nodes, such as Donald Trump. Usually with property graphs your data is normalized, so you would have a single node to represent an entity and not duplicates, yet for the purposes of display you would seem to need multiples of the same nodes, otherwise you would have the same Donald Trump node with relationships to each of these, in ways that doesn't covey information clearly the way your example graph does.

All these things lead me to believe you're not really looking for a database, but a visualization tool for a graphical presentation, where that presentation is different enough from the property graph model that you're likely to run into frustration trying to use it for something it's not designed for.

Is that the case? If not, we'd need to know more about the kinds of queries you're planning to run. You may also want to look at different visualization tools that may be able to convey richer views of your data.