Anders and Briegel in Python
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

19 行
351B

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