AddFirstElements sets the provided elements to be first in all orderings. 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 begin with {D, B, A}
(nodes ...string)
| 123 | // So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} |
| 124 | // then we are guaranteed that the total ordering will begin with {D, B, A} |
| 125 | func (dag *DAG) AddFirstElements(nodes ...string) error { |
| 126 | nodeIDs, err := dag.namesToIDs(nodes) |
| 127 | if err != nil { |
| 128 | return err |
| 129 | } |
| 130 | |
| 131 | return dag.addFirst(nodeIDs) |
| 132 | } |
| 133 | |
| 134 | func (dag *DAG) addFirst(nodes []int) error { |
| 135 | nodeMap := map[int]bool{} |