finish adjacent matrix graph