Convert Graph from Java to Scala