Hi, This may be too elementary for most of you, but could you please help me with the following question? I would like to use comprehensive lists and lists of lists. Where do I start?
Question: Consider a digraph with 10 vertices, labeled 1 through 10. You are given the following adjacency list representation, where we first list the vertices adjacent to vertex 1, and so on. 1*; *2; 2*; *3; 3*; *4; 4*; *5; 5*; *6; 6*; *7; 7*; *8; 8*; *9; 9*; *10; 10. a) Write code to turn the adjacency list into an incidence list and an an adjacency matrix. b) Write code to turn the incidence list into an adjacency matrix. Hint: You may find it useful to note that one incidence list representation is (1*; *1), (2*; *2), (3*; *3), (4*; *4), (5*; *5),(6*; *6), (7*; *7), (8*; *8), (9*; *9), (10*; *10), (1*; *2), (2*; *3), (3*; *4), (4*; *5), (5*; *6), (6*; *7), (7*; *8), (8*; *9), (9*; *10).
_______________________________________________ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk