Hi, trying to structure build a graph that models hierarchy between nodes and has a notion of order between siblings. Upon querying, it's important that this hierarchy and order information is preserved.
I've read into apoc.convert.toTree(), and it seems like we can combine that with Cypher to return hierarchical, nested JSON: https://stackoverflow.com/questions/34234373/using-cypher-to-return-nested-hierarchical-json-from-a-tree
However, how might I introduce ordering between sibling nodes? I understand we can use ORDER_BY to sort nodes according to a particular property, but in this case it's important ordering acts as a list, e.g. we can insert, remove, and move around elements without needing to update a specific property on lots of elements simultaneously.
I've looked into using a linked list relationship, but it seems like that would be incompatible with apoc.convert.toTree(), as the linked list would return as a deeply nested tree.
How might I maintain both hierarchy and order in the graph? Is it possible to use UNWIND on elements of a linked list so they flatten before using apoc.convert.toTree()?
Thanks for your help and suggestions.