save tp and sp adjacent matrix