I have a graph database like this one
Is there a way to return the two subtrees as a tree structure excluding "B" relationships? My wish is to generate a JSON describing the hierarchical structure of the two subtrees in a format like this
{
"graph":{
"food": {
"attr1":"some attr",
"children": {
"pizza":{
"attr1":"some attr",
"children":{
"pizza1":{
"attr1":"some attr"
},
"pizza2":{
"attr1":"some attr"
},
"pizza3":{
"attr1":"some attr"
}
}
},
"pie":{
"attr1":"some attr",
"children":{}}
}
},
"topping": {
"attr1":"some attr",
"children": {
"meat":{
"attr1":"some attr",
"children":{
"pepperoni":{
"attr1":"some attr"
},
"beef":{
"attr1":"some attr"
}
}
},
"vegetables":{
"attr1":"some attr",
"children":{
"onion":{
"attr1":"some attr"
},
"eggplant":{
"attr1":"some attr"
}
}
}
}
}
}
}
I know there's APOC plugin for Neo4j but I don't know if it can be used for something like this.