Made Graph trait polymorphic.

I used a collections::hash::HashMap to store
vertices of type T and map them to uint for the
matrix.