Consistent Cut Check
Consistent Cut Check
A global cut is consistent if it does not include an event without all of its causal predecessors.
You are given:
cuts[i]: number of events from processiincluded in the cut.clocks[i]: vector clock of the last included event at processi.
The cut is consistent iff for all processes i and j: clocks[i][j] <= cuts[j].
Missing vector clock entries are treated as 0.
Return true if the cut is consistent, otherwise false.
Function signature
func IsConsistentCut(cuts []int, clocks [][]int) bool
Example
cuts = [1,0]
clocks = [[1,1], []]
output = false
The event on process 0 depends on an event from process 1 that is not included in the cut.
Constraints
0 <= len(cuts) <= 100000len(clocks) == len(cuts)0 <= cuts[i] <= 1_000_0000 <= clocks[i][j] <= 1_000_000
Notes
- If
cuts[i] == 0,clocks[i]may be empty or all zeros.
Run tests to see results
No issues detected