init graph and clone context