anchor.diff:  %%
   %%      We monitor all edge Pids to know when they die or get restarted.
   %%
  -handle_call({add_edges, Src, Dst, Pid, ReadFuns, TransFun, {Dst, WriteFun}},
  -            _From, #state{dag=Dag, process_map=Pm, contraction_step=CtStep}=State) ->
  +handle_call({add_edges, Src, Dst, Pid, ReadFuns, TransFun, {Dst, WriteFun}}, _From, State) ->
  +
  +    Dag      = State#state.dag,
  +    Pm       = State#state.process_map,
  +    CtStep   = State#state.contraction_step,
  +    OptMap   = State#state.optimized_map,
  +    PidTable = State#state.pid_table,
   
       %% Add vertices only if they are either sources or sinks. (See add_if)
       %% All user-defined variables are tracked through the `declare` function.
       lists:foreach(fun(V) -> add_if_pid(Dag, V) end, Src),
       add_if_pid(Dag, Dst),
  +
  +    %% Check if this edge is the replacement for an old edge in the graph.
  +    {NewOptMap, NewPidTable} = replace_if_restarted(OptMap, PidTable, Pid,
  +                                                                      {ReadFuns,
  +                                                                       TransFun,
  +                                                                       {Dst, WriteFun}}),
  +
   
       %% @todo This should happen before creating the process
       %%
  
positive.code:                            transform :: function(),
                             write :: function()}).
  
  %% We store a mapping Pid -> {Path, MetadataList} to identify the list of
  %% vertices and relationships that get removed as part of a path contraction.
  %%
  %% Used during the cleaving step.
  -type optimized_map() :: dict:dict(pid(),
                                     {contract_path(),
                                      list(#process_metadata{})}).
  
  -record(state, {dag :: digraph:graph(),
                  process_map :: process_map(),
                  optimized_map :: optimized_map(),
                  contraction_step :: non_neg_integer()}).
  
  %% We store the function metadata as the edge label.
  
negative.code:         end, OldPids)
      end),
  
      dict:store(Id, {Pid, VSeq, Metadata}, OptMap).
  
  %% @doc Check if a list of future edges involving contracted vertices introduce a loop.
  %%
  