mirror of https://gitee.com/bigwinds/arangodb
Graph: Replace a given edge by ID
This commit is contained in:
parent
04c7cfce33
commit
6049ef11fb
|
@ -287,6 +287,14 @@ Graph.prototype._replaceVertex = function (id, data) {
|
||||||
GraphAPI.putVertex(this._properties._key, id, data);
|
GraphAPI.putVertex(this._properties._key, id, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief replace an edge in the graph
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Graph.prototype._replaceEdge = function (id, data) {
|
||||||
|
GraphAPI.putEdge(this._properties._key, id, data);
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief returns a vertex given its id
|
/// @brief returns a vertex given its id
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -793,6 +793,18 @@ Graph.prototype.replaceVertex = function (id, data) {
|
||||||
this._replaceVertex(id, data);
|
this._replaceVertex(id, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief replaces an existing edge by ID
|
||||||
|
///
|
||||||
|
/// @FUN{@FA{graph}.replaceEdge(@FA{id}, @FA{data})}
|
||||||
|
///
|
||||||
|
/// Replaces an existing edge by ID
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Graph.prototype.replaceEdge = function (id, data) {
|
||||||
|
this._replaceEdge(id, data);
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief returns the number of vertices
|
/// @brief returns the number of vertices
|
||||||
///
|
///
|
||||||
|
|
|
@ -239,6 +239,22 @@ function GraphBasicsSuite() {
|
||||||
assertEqual(edge._properties._key, edge.getId());
|
assertEqual(edge._properties._key, edge.getId());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testReplaceEdge : function () {
|
||||||
|
var v1,
|
||||||
|
v2,
|
||||||
|
edge;
|
||||||
|
|
||||||
|
v1 = graph.addVertex("vertex1");
|
||||||
|
v2 = graph.addVertex("vertex2");
|
||||||
|
|
||||||
|
graph.addEdge(v1, v2, "my-edge");
|
||||||
|
|
||||||
|
graph.replaceEdge("my-edge", { weight: 2 });
|
||||||
|
edge = graph.getEdge("my-edge");
|
||||||
|
|
||||||
|
assertEqual(2, edge.getProperty("weight"));
|
||||||
|
},
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief change a property
|
/// @brief change a property
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -602,6 +602,14 @@ Graph.prototype._replaceVertex = function (vertex_id, data) {
|
||||||
var result = this._vertices.replace(vertex_id, data);
|
var result = this._vertices.replace(vertex_id, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief replaces an edge in the graph
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Graph.prototype._replaceEdge = function (edge_id, data) {
|
||||||
|
var result = this._edges.replace(edge_id, data);
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief returns a vertex given its id
|
/// @brief returns a vertex given its id
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue