Detecting community structure in networks by representative energy