Function node (value, distance, index)

value

Format:

node (value, distance, index)

Input:

any value -
number distance -
any index -

Output:

list - None

Properties that reference this function:

result of pushing nodes [ pair (value, weight), rest ] into tree tree where parent is index and parent distance is distance = result of pushing nodes rest into tree [ node (value, (distance + weight), index), tree ] where parent is index and parent distance is distance (push children node)
shortest path from node v to every other node in graph graph = output of the shortest_path function where the input graph is graph, backwards index is 0, and tree is [ node (v, 0, None), [ ] ] (compute shortest path begin)

Conditional properties that reference this function:

  • if el = val, then index of value val in [ node (el, w, p), remain ] with current index idx = idx (link)
  • if not (el = val), then index of value val in [ node (el, w, p), remain ] with current index idx = index of value val in remain with current index (idx + 1) (link)
  • if elem = value, then tree [ node (elem, d, p), rest ] contains value = True (link)
  • if not (elem = value), then tree [ node (elem, d, p), rest ] contains value = tree rest contains value (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)

    then children of the node at backwards index index of tree tree in graph graph = output of the find_neighbors function where the input graph is graph, node is value, and children are [ ]

    (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
    • 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