matrix graph implementation and sequential stack/queue implementation