added adj matrix graph representation