code: def test_add_edge(distributions):
      d1, d2, d3, d4, d12, d22, d32, d13 = distributions
  
      model = BayesianNetwork([d1, d2, d12, d22, d13])
      assert len(model.distributions) == 5
      assert len(model.edges) == 0
      assert model._factor_graph._factor_edges == [
          [0],
          [1],
          [2],
          [3],
          [4],
      ]
      assert model._factor_graph._marginal_edges == [
          [0],
          [1],
          [2],
          [3],
          [4],
      ]
  
      model.add_edge(d1, d12)
      assert len(model.distributions) == 5
      assert len(model.edges) == 1
      assert model._factor_graph._factor_edges == [
          [0],
          [1],
          [0, 2],
          [3],
          [4],
      ]
      assert model._factor_graph._marginal_edges == [
          [2, 0],
          [1],
          [2],
          [3],
          [4],
      ]
  
      model.add_edge(d1, d22)
      assert len(model.distributions) == 5
      assert len(model.edges) == 2
      assert model._factor_graph._factor_edges == [
          [0],
          [1],
          [0, 2],
          [0, 3],
          [4],
      ]
      assert model._factor_graph._marginal_edges == [
          [2, 3, 0],
          [1],
          [2],
          [3],
          [4],
      ]
  
      model.add_edge(d2, d13)
      model.add_edge(d1, d13)
      assert len(model.distributions) == 5
      assert len(model.edges) == 4
      assert model._factor_graph._factor_edges == [
          [0],
          [1],
          [0, 2],
          [0, 3],
          [1, 0, 4],
      ]
      assert model._factor_graph._marginal_edges == [
          [2, 3, 4, 0],
          [4, 1],
          [2],
          [3],
          [4],
      ]
  
imports: import numpy
  import torch
  import pytest
  from pomegranate.bayesian_network import BayesianNetwork
  from pomegranate.distributions import Exponential
  from pomegranate.distributions import Categorical
  from pomegranate.distributions import ConditionalCategorical
  from nose.tools import assert_raises
  from numpy.testing import assert_array_equal
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 10 for calling a global function with example usage: test_add_edge(distributions) without return types