Add state_by_node2state_by_state util