created functions to find s and find edge data