Anders and Briegel in Python
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
370B

  1. from graph import Graph
  2. def test_graph():
  3. g = Graph(3)
  4. g.add_edge(0,1)
  5. g.add_edge(1,2)
  6. g.add_edge(2,0)
  7. assert g.neighbours[0]==set([1,2])
  8. g.del_edge(0,1)
  9. assert g.neighbours[0]==set([2])
  10. el = g.edgelist()
  11. assert (1,2) in el
  12. assert not (0,1) in el
  13. assert len(el)==2
  14. assert g.has_edge(1,2)
  15. assert not g.has_edge(0,1)