extracting minimal cycle basis