A relation on trees and the topological indices based on subgraph