# [Tutor] Help Please

Python Freak newtopython at gmail.com
Sun Jan 28 23:57:04 CET 2007

```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

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).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070128/a887a1a9/attachment.html
```