Anders and Briegel in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 8 години
1234567891011121314151617181920212223242526
  1. from abp.graphstate import GraphState
  2. def demograph():
  3. """ A graph for testing with """
  4. g = GraphState()
  5. g.add_edge(0, 1)
  6. g.add_edge(1, 2)
  7. g.add_edge(2, 0)
  8. g.add_edge(0, 3)
  9. g.add_edge(100, 200)
  10. return g
  11. def test_nx_convert():
  12. g = demograph()
  13. n = g.to_networkx()
  14. assert len(g.ngbh) == len(n.edge)
  15. assert len(g.vops) == len(n.node)
  16. def test_layout():
  17. g = demograph()
  18. g.layout()
  19. assert len(g.meta) == len(g.vops)
  20. assert "pos" in g.meta[0]
  21. assert "x" in g.meta[0]["pos"]