Class Graph rewritten using jGrapht library