Symmetry-based invariants of nanostructures and their effect on edge states of carbon nanotubes