Autodetect topology