anchor.diff:                      read :: function(),
                       transform :: function(),
                       write :: function()}).
  +
  +%% @todo Move somewhere else
  +%% A tuple of the arguments of a lasp process.
  +-type process_args() :: {[{lasp_vertex(), function()}], function(), {lasp_vertex(), function()}}.
   
   %% @todo For now, maybe changed for another data structure
   -record(vertex_label, {pointer_pid :: pid()}).
  
positive.code:          terminate/2,
           code_change/3]).
  
  %% @todo Remove. Debug only
  -export([contract/0]).
  
  %% Defines how often an optimization pass happens.
  %% A value of 0 means the optimization happens every time.
  -define(CONTRACTION_INTERVAL, 0).
  
negative.code:         end, OldPids)
      end),
  
      dict:store(Pid, {UnnecesaryVertices, UnnecessaryDict}, OptMap).
  
  %% @doc If the given vertex was part of a contracted path, cleave it
  %%
  %%      Contracted vertices contain a pointer to the Pid of the process
  %%      that forms the contraction of the path.
  %%
  -spec cleave_if_contracted(digraph:graph(), lasp_vertex()) -> ok.
  cleave_if_contracted(G, Vertex) ->
      case digraph:vertex(G, Vertex) of
          {_, #vertex_label{pointer_pid = Pid}} ->
              spawn_link(fun() ->
                  lasp_process_sup:terminate_child(lasp_process_sup, Pid)
              end),
              ok;
          _ -> ok
      end.
  
  %% @doc Cleave the path represented by the given process Pid.
  %%
  %%      If the Pid represents a process that contracted a path,
  %%      start all the intermediate processes of the path,
  %%      and then kill the given Pid.
  %%
  cleave_associated_path(G, Pid, OptMap) ->
      case dict:find(Pid, OptMap) of
          error -> ok;
          {ok, {VSeq, InnerDict}} ->
              ProcessArgs = unpack_opt_inner_dict(InnerDict),
              tag_vertices(G, VSeq, []),
              spawn_link(fun() ->
                  lists:foreach(fun({_Reads, _TransForms, _Write}=Args) ->
                      lasp_process:start_dag_link(tuple_to_list(Args))
                  end, ProcessArgs)
              end)
      end.
  
  %% @doc Get the process arguments of the given optimized map inner dict.
  %%
  
  -spec unpack_opt_inner_dict(dict:dict(lasp_vertex(),
                                        {lasp_vertex(),
                                         #process_metadata{}})) -> list(process_args()).
  unpack_opt_inner_dict(OptInnerMap) ->
      dict:fold(fun(Parent, {Child, Metadata}, Acc) ->
          ReadFun = Metadata#process_metadata.read,
          Read = {Parent, ReadFun},
  
          Transform = Metadata#process_metadata.transform,
  
          WriteFun = Metadata#process_metadata.write,
          Write = {Child, WriteFun},
  
          ProcessArgs = {[Read], Transform, Write},
          [ProcessArgs | Acc]
      end, [], OptInnerMap).
  
  %% @doc Given a path contraction candidate in the graph, return the process
  %%      metadata from all intermediate edges.
  