building the transition dictionary in Spark!