<s> from nose . tools import * <EOL> import networkx as nx <EOL> from networkx import * <EOL> def test_complement ( ) : <EOL> null = null_graph ( ) <EOL> empty1 = empty_graph ( <NUM_LIT:1> ) <EOL> empty10 = empty_graph ( <NUM_LIT:10> ) <EOL> K3 = complete_graph ( <NUM_LIT:3> ) <EOL> K5 = complete_graph ( <NUM_LIT:5> ) <EOL> K10 = complete_graph ( <NUM_LIT:10> ) <EOL> P2 = path_graph ( <NUM_LIT:2> ) <EOL> P3 = path_graph ( <NUM_LIT:3> ) <EOL> P5 = path_graph ( <NUM_LIT:5> ) <EOL> P10 = path_graph ( <NUM_LIT:10> ) <EOL> G = complement ( K3 ) <EOL> assert_true ( is_isomorphic ( G , empty_graph ( <NUM_LIT:3> ) ) ) <EOL> G = complement ( K5 ) <EOL> assert_true ( is_isomorphic ( G , empty_graph ( <NUM_LIT:5> ) ) ) <EOL> P3cc = complement ( complement ( P3 ) ) <EOL> assert_true ( is_isomorphic ( P3 , P3cc ) ) <EOL> nullcc = complement ( complement ( null ) ) <EOL> assert_true ( is_isomorphic ( null , nullcc ) ) <EOL> b = bull_graph ( ) <EOL> bcc = complement ( complement ( b ) ) <EOL> assert_true ( is_isomorphic ( b , bcc ) ) <EOL> def test_complement_2 ( ) : <EOL> G1 = nx . DiGraph ( ) <EOL> G1 . add_edge ( '<STR_LIT:A>' , '<STR_LIT:B>' ) <EOL> G1 . add_edge ( '<STR_LIT:A>' , '<STR_LIT:C>' ) <EOL> G1 . add_edge ( '<STR_LIT:A>' , '<STR_LIT:D>' ) <EOL> G1C = complement ( G1 ) <EOL> assert_equal ( sorted ( G1C . edges ( ) ) , <EOL> [ ( '<STR_LIT:B>' , '<STR_LIT:A>' ) , ( '<STR_LIT:B>' , '<STR_LIT:C>' ) , <EOL> ( '<STR_LIT:B>' , '<STR_LIT:D>' ) , ( '<STR_LIT:C>' , '<STR_LIT:A>' ) , ( '<STR_LIT:C>' , '<STR_LIT:B>' ) , <EOL> ( '<STR_LIT:C>' , '<STR_LIT:D>' ) , ( '<STR_LIT:D>' , '<STR_LIT:A>' ) , ( '<STR_LIT:D>' , '<STR_LIT:B>' ) , ( '<STR_LIT:D>' , '<STR_LIT:C>' ) ] ) <EOL> def test_reverse1 ( ) : <EOL> G1 = nx . Graph ( ) <EOL> assert_raises ( nx . NetworkXError , nx . reverse , G1 ) </s>
