Function result of updating nodes children in tree tree with parent index index and parent distance distance

tree

Format:

result of updating nodes children in tree tree with parent index index and parent distance distance

Input:

list tree -
number index -
number distance -
list children -

Output:

list - None

Properties that reference this function:

result of updating nodes [ ] in tree tree with parent index index and parent distance distance = tree (d update children finished)

Conditional properties that reference this function:

  • if the following are true:
    • the element at index child_i of stack tree = node (child_value, child_d, child_prev)
    • distance + weight < child_d
    • result of storing (node (child_value, (distance + weight), index)) at index child_i of stack tree = updated

    then result of updating nodes [ pair (child_i, weight), rest ] in tree tree with parent index index and parent distance distance = result of updating nodes rest in tree updated with parent index index and parent distance distance

    (link)
  • if the following are true:
    • the element at index child_i of stack tree = node (child_value, child_d, child_prev)
    • distance + weight > child_d

    then result of updating nodes [ pair (child_i, weight), rest ] in tree tree with parent index index and parent distance distance = result of updating nodes rest in tree tree with parent index index and parent distance distance

    (link)
  • if the following are true:
    • ((length of stack tree) - 1) - index = back_i
    • the element at index back_i of stack tree = node (value, distance, previous)
    • result of splitting pairs into nodes that exist in the tree tree and new nodes = pair (exists, new)
    • result of updating nodes exists in tree tree with parent index index and parent distance distance = updated

    then result of adding or updating children pairs of the node at backwards index index in tree tree = result of pushing nodes new into tree updated where parent is index and parent distance is distance

    (link)


Comments

Please log in to add comments