Sequence sets a sequence of ordering constraints. So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} then we are guaranteed that the total ordering will have D comes before B comes before A. (They're may be elements interspersed, e.g. {D, C, E, B, A} is a valid order
(seq ...string)
| 81 | // then we are guaranteed that the total ordering will have D comes before B comes before A. |
| 82 | // (They're may be elements interspersed, e.g. {D, C, E, B, A} is a valid ordering) |
| 83 | func (ord *PartialOrdering) Sequence(seq ...string) { |
| 84 | // We make every node in the sequence have a prior node |
| 85 | for i := 0; i < (len(seq) - 1); i++ { |
| 86 | err := ord.dag.AddEdge(seq[i], seq[i+1]) |
| 87 | handleDAGErr(err) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // TotalOrdering returns a deterministically chosen total ordering that satisfies all specified |
| 92 | // partial ordering constraints. |