79673510

Date: 2025-06-20 14:06:03
Score: 0.5
Natty:
Report link

This worked

CREATE QUERY sort_edge_attribute_value() FOR GRAPH workflow_graph SYNTAX v3 {
    TYPEDEF TUPLE <src_node_id INT, dst_node_id INT, weight FLOAT> myTuple;
    HeapAccum<myTuple>({heap_size}, weight ASC) @@sorted_edges;
    res = SELECT s FROM (s:Node)-[e:Edge]-(t:gsbNode) ACCUM @@sorted_edges += myTuple(s.node_id, t.node_id, e.weight);
    PRINT @@sorted_edges;
}

Here heap size represents the number of rows we need to sort.

I wonder though, why this roundabout way of sorting edges when sorting nodes is so easy. Cypher allows sorting both nodes and edges very easily

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Ameya Patil