Generate paths and cycles