Finding an advisor without enrolling into a university
First of all, I wouldn't seek an advisor. Under your circumstances, you shouldn't expect a professor to assume any sort of responsibility for you. That said, you might be able to find someone who is willing to help you. Here are two ideas:

Find a graduate course that you are interested in, and ask the professor if you can sit in on it. The professor might well say no, but they might say yes. If they say yes, then work hard, do all the homework and do it well, and ask good questions. When I was applying to graduate school, I was very fortunate to have a professor who was willing to do this for me.

Attend a scientific conference. Go to talks, and talk to people afterwards. Ask questions. If you have an idea for how to make progress on a question of interest to one of the speakers, you may be able to strike up a collaboration.


In either case, you could ask for a rec letter later.
Finally, at least in the US, it's common to apply to PhD programs with only an undergraduate degree in the same field, and to get letters of recommendation from your undergrad professors. So, if you recently completed an undergrad program in CS, and you made a strong impression on your professors, then you might try simply applying to PhD programs now.