Accessing Neo4j index to get edges sorted by weight

Hi.

We are working on a plugin for Neo4j that performs a special purpose graph traversal algorithm. The algorithm takes a weight property into account on edges, and we would like to get the edges in sorted order, to process them in the optimal order (without having to read all edges from the node). My understanding is that Neo4j has a concept of range index on relationship properties, but I can only access it indirectly e.g. with a cypher query that filters on that property.

What we would like to know is if it's possible to access the internal index on the Neo4j server to somehow achieve getting the edges in sorted order?

Thanks,
Simon

I also have developed a collection of traversal methods I use for my application. I have not seen such a capability that you are asking for. I question whether it would even be beneficial if it did exist for your purpose of sorting. How many relationships do your nodes typically have? I only have a handful of relationships per node. I just sort them b before processing. My algorithms typically execute in 10's of ms on my Mac laptop. I do the following:

itemRelationships = StreamSupport.stream(itemNode.getRelationships(Direction.INCOMING, RelationshipLabels.HAS_PARENT).spliterator(), false)
                .sorted(Comparator.comparingLong(x -> (Long) x.getStartNode().getProperty("key")))
                .collect(Collectors.toList());

Thanks for the quick reply Gary. We have a fairly large graph and the relationships can run into the thousands for a single node.