completed c graph creation