MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / IntersectWithLin

Function IntersectWithLin

algo/uidlist.go:170–191  ·  view source on GitHub ↗

IntersectWithLin performs the intersection linearly.

(u, v []uint64, o *[]uint64)

Source from the content-addressed store, hash-verified

168
169// IntersectWithLin performs the intersection linearly.
170func IntersectWithLin(u, v []uint64, o *[]uint64) (int, int) {
171 n := len(u)
172 m := len(v)
173 i, k := 0, 0
174 for i < n && k < m {
175 uid := u[i]
176 vid := v[k]
177 switch {
178 case uid > vid:
179 for k = k + 1; k < m && v[k] < uid; k++ {
180 }
181 case uid == vid:
182 *o = append(*o, uid)
183 k++
184 i++
185 default:
186 for i = i + 1; i < n && u[i] < vid; i++ {
187 }
188 }
189 }
190 return i, k
191}
192
193// IntersectWithJump performs the intersection linearly but jumping jump steps
194// between iterations.

Callers 2

IntersectWithFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…