/**
  * replaces an edge definition of the graph.
  *
  * This will replace an edge definition in the graph.<br><br>
  *
  *
  * @throws Exception
  *
  * @param mixed $graph - graph name as a string or instance of Graph
  * @param EdgeDefinition $edgeDefinition  - the edge definition.
  *
  * @return Graph
  * @since 2.2
  */
 public function replaceEdgeDefinition($graph, $edgeDefinition)
 {
     if ($graph instanceof Graph) {
         $graph = $graph->getKey();
     }
     $url = UrlHelper::buildUrl(Urls::URL_GRAPH, array($graph, Urls::URLPART_EDGE, $edgeDefinition->getRelation()));
     $data = $edgeDefinition->transformToArray();
     try {
         $response = $this->getConnection()->put($url, $this->json_encode_wrapper($data));
     } catch (Exception $e) {
         throw new ClientException($e->getMessage());
     }
     $data = $response->getJson();
     $options['_isNew'] = false;
     $result = Graph::createFromArray($data['graph'], $options);
     $result->set(Graph::ENTRY_KEY, $data['graph'][self::OPTION_NAME]);
     return $result;
 }