Heap of sorted Edges

Is there anyway one can sort edges in a Heap ?
Cheers & Thanks
/k

@ksankar (see below)

HeapAccum

The HeapAccum type maintains a sorted collection of tuples and enforces a maximum number of tuples in the collection. The output of a HeapAccum is a sorted collection of tuple elements. The += operation adds a tuple to the collection in sorted order. If the HeapAccum is already at maximum capacity when the += operator is applied, then the tuple which is last in the sorted order is dropped from the HeapAccum. Sorting of tuples is performed on one or more defined tuple fields ordered either ascending or descending. Sorting precedence is performed based on defined tuple fields from left to right.

You must have defined a custom tuple type to declare a HeapAccum, and one of the fields in the tuple must be a data type that can be sorted.

The declaration syntax is outlined in the figure below:

HeapAccum declaration syntax

HeapAccum<tupleType>( [capacity,] field_a [ASC|DESC],... , field_z [ASC|DESC]);

In the declaration of the HeapAccum, the keyword HeapAccum is followed by the tuple type in angle brackets < >. This is followed by a parenthesized list of two or more parameters.

  • If the first parameter is a positive integer, it sets the maximum number of tuples that the HeapAccum may store.
  • The subsequent parameters are a subset of the tuple’s field, which are used as sort keys. The sort key hierarchy is from left to right, with the leftmost key being the primary sort key. The keywords ASC and DESC indicate Ascending (lowest value first) or Descending (highest value first) sort order. Ascending order is the default.
1 Like

Jon,
Thanks. I got that and am working with the heap of tuples. Was wondering if it can take edges. Probably as part of a tuple, which I haven’t tries yet.
Cheers
/k