Graph builder for Java class