Force based algorithm for composing graphs