check edges while reading graph