implemented function adjListToMatrix