Skip to content

test_katz fails in CI #37

@rafguns

Description

@rafguns

On both 3.8 and 3.11. Here's the output for 3.11:

 =================================== FAILURES ===================================
  __________________________________ test_katz ___________________________________
  
      def test_katz():
          G = nx.Graph()
          G.add_weighted_edges_from(
              [(1, 2, 1), (0, 2, 5), (2, 3, 1), (0, 4, 2), (1, 4, 1), (3, 5, 1), (4, 5, 3)]
          )
      
          beta = 0.01
          I = np.identity(6)
          for weight in ("weight", None):
              katz = Katz(G).predict(beta=beta, weight=weight)
      
              nodes = list(G.nodes())
              M = nx.to_numpy_array(G, nodelist=nodes, weight=weight)
              K = np.linalg.matrix_power(I - beta * M, -1) - I
      
              x, y = np.asarray(K).nonzero()
              for i, j in zip(x, y):
                  if i == j:
                      continue
                  u, v = nodes[i], nodes[j]
  >               assert K[i, j] == pytest.approx(katz[(u, v)], abs=1e-5)
  E               assert 0.010038160831933126 == 0.010101010100000004 ± 1.0e-05
  E                 comparison failed
  E                 Obtained: 0.010038160831933126
  E                 Expected: 0.010101010100000004 ± 1.0e-05
  
  tests/test_predictors_path.py:28: AssertionError
  ----------------------------- Captured stdout call -----------------------------
  Computing matrix powers: [............................................................] 0/5
  Computing matrix powers: [############................................................] 1/5
  Computing matrix powers: [########################....................................] 2/5
  Computing matrix powers: [####################################........................] 3/5
  Computing matrix powers: [################################################............] 4/5
  Computing matrix powers: [############################################################] 5/5

Weirdly enough, this test passes on my computer. Perhaps this is due to a differnece in version of some package, like numpy?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions