docs: def infer_edge(tpm, a, b, contexts):
      """Infer the presence or absence of an edge from node A to node B.
  
      Let |S| be the set of all nodes in a network. Let |A' = S - {A}|. We call
      the state of |A'| the context |C| of |A|. There is an edge from |A| to |B|
      if there exists any context |C(A)| such that |Pr(B | C(A), A=0) != Pr(B |
      C(A), A=1)|.
  
      Args:
          tpm (np.ndarray): The TPM in state-by-node, multidimensional form.
          a (int): The index of the putative source node.
          b (int): The index of the putative sink node.
      Returns:
          bool: ``True`` if the edge |A -> B| exists, ``False`` otherwise.
      """
  
      def a_in_context(context):
          """Given a context C(A), return the states of the full system with A
          OFF and ON, respectively.
          """
          a_off = context[:a] + OFF + context[a:]
          a_on = context[:a] + ON + context[a:]
          return (a_off, a_on)
  
      def a_affects_b_in_context(context):
          """Return ``True`` if A has an effect on B, given a context."""
          a_off, a_on = a_in_context(context)
          return tpm[a_off][b] != tpm[a_on][b]
  
      return any(a_affects_b_in_context(context) for context in contexts)