()
| 2592 | } |
| 2593 | |
| 2594 | func (sg *SubGraph) updateDestUids() { |
| 2595 | // Update sg.destUID. Iterate over the UID matrix (which is not sorted by |
| 2596 | // UID). For each element in UID matrix, we do a binary search in the |
| 2597 | // current destUID and mark it. Then we scan over this bool array and |
| 2598 | // rebuild destUIDs. |
| 2599 | included := make([]bool, len(sg.DestUIDs.Uids)) |
| 2600 | for _, ul := range sg.uidMatrix { |
| 2601 | for _, uid := range ul.Uids { |
| 2602 | idx := algo.IndexOf(sg.DestUIDs, uid) // Binary search. |
| 2603 | if idx >= 0 { |
| 2604 | included[idx] = true |
| 2605 | } |
| 2606 | } |
| 2607 | } |
| 2608 | algo.ApplyFilter(sg.DestUIDs, func(uid uint64, idx int) bool { return included[idx] }) |
| 2609 | } |
| 2610 | |
| 2611 | func (sg *SubGraph) sortAndPaginateUsingFacet(ctx context.Context) error { |
| 2612 | if len(sg.facetsMatrix) == 0 { |
no test coverage detected