Detecting structural cycles