1
0
Fork 0
arangodb/Doxygen/doc/JSModuleGraph.html

553 lines
20 KiB
HTML

<html><head><title>ArangoDB Manual</title> <style media="screen" type="text/css" style="display:none">body{background-color:white;font:13px Helvetica,arial,freesans,clean,sans-serif;line-height:1.4;color:#333;}#access{font-size:16px;margin-left:12px;display:block;margin-left:10px;margin-right:10px;background-color:#F3F1EE!important;}#access a{border-right:1px solid #DBDEDF;color:#A49F96;display:block;line-height:38px;padding:0 10px;text-decoration:none;}#navigation ul{text-transform:uppercase;list-style:none;margin:0;}#navigation li{float:left;position:relative;}#container{width:920px;margin:0 auto;}a{color:#4183C4;text-decoration:none;}.contents h2{font-size:24px;border-bottom:1px solid #CCC;color:black;}.contents h1{font-size:33px;border-bottom:1px solid #CCC;color:black;}.clearfix:after{content:".";display:block;clear:both;font-size:0;height:0;visibility:hidden;}/**/ *:first-child+html .clearfix{min-height:0;}/**/ * html .clearfix{height:1%;}</style></head><body><div id="container"><img src="images/logo_arangodb.png" width="397" height="67" alt="ArangoDB"><div id="access" role="navigation"><div id="navigation"><ul id="menu-ahome" class="menu"><li><a href="Home.html">Table of contents</a></li> <li><a href="http://www.arangodb.org">ArangoDB homepage</a></li></ul></div><div class="clearfix"></div></div><div>
<!-- Generated by Doxygen 1.7.5.1 -->
</div>
<div class="header">
<div class="headertitle">
<h1>Module "graph" </h1> </div>
</div>
<div class="contents">
<div class="textblock"><p>The graph module provides basic functions dealing with graph structures. The examples assume</p>
<div class="fragment"><pre class="fragment">arango&gt; var Graph = require("graph").Graph;
arango&gt; g = new Graph("graph", "vertices", "edges");
Graph("graph")
</pre></div><hr/>
<ol>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraph">Graph Constructors and Methods</a> <ol>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraphAddEdge">Graph.addEdge</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraphAddVertex">Graph.addVertex</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraphConstructor">Graph constructor</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraphGetVertex">Graph.getEdges</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraphGetVertex">Graph.getVertex</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraphGetVertices">Graph.getVertices</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraphRemoveEdge">Graph.removeEdge</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraphRemoveVertex">Graph.removeVertex</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphGraphDrop">Graph.drop</a> </li>
</ol>
</li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertex">Vertex Methods</a> <ol>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexAddInEdge">Vertex.addInEdge</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexAddOutEdge">Vertex.addOutEdge</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexEdges">Vertex.edges</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexGetId">Vertex.getId</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexGetInEdges">Vertex.getInEdges</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexGetOutEdges">Vertex.getOutEdges</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexGetProperty">Vertex.getProperty</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexGetPropertyKeys">Vertex.getPropertyKeys</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexProperties">Vertex.properties</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphVertexSetProperty">Vertex.setProperty</a> </li>
</ol>
</li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphEdge">Edge Methods</a> <ol>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphEdgeGetId">Edge.getId</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphEdgeGetInVertex">Edge.getInVertex</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphEdgeGetLabel">Edge.getLabel</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphEdgeGetOutVertex">Edge.getOutVertex</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphEdgeGetProperty">Edge.getProperty</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphEdgeGetPropertyKeys">Edge.getPropertyKeys</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphEdgeProperties">Edge.properties</a> </li>
<li>
<a class="el" href="JSModuleGraph.html#JSModuleGraphEdgeSetProperty">Edge.setProperty</a> </li>
</ol>
</li>
</ol>
<hr/>
<h2><a class="anchor" id="JSModuleGraphGraph"></a>
Graph Constructors and Methods</h2>
<p><a class="anchor" id="JSModuleGraphGraphConstructor"></a> <hr/>
<code><b>Graph(<em>name</em>, <em>vertices</em>, <em>edges</em>)</b></code><hr/>
Constructs a new graph object using the collection <em>vertices</em> for all vertices and the collection <em>edges</em> for all edges. Note that it is possible to construct two graphs with the same vertex set, but different edge sets.</p>
<hr/>
<code><b>Graph(<em>name</em>)</b></code><hr/>
Returns a known graph.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; var Graph = require("graph").Graph;
arango&gt; new Graph("graph", db.vertices, db.edges);
Graph("graph")
arango&gt; new Graph("graph", "vertices", "edges");
Graph("graph")
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphGraphAddEdge"></a> <hr/>
<code><b><em>graph</em>.addEdge(<em>out</em>, <em>in</em>, <em>id</em>)</b></code><hr/>
Creates a new edge from <em>out</em> to <em>in</em> and returns the edge object. The identifier <em>id</em> must be a unique identifier or null.</p>
<hr/>
<code><b><em>graph</em>.addEdge(<em>out</em>, <em>in</em>, <em>id</em>, <em>label</em>)</b></code><hr/>
Creates a new edge from <em>out</em> to <em>in</em> with <em>label</em> and returns the edge object.</p>
<hr/>
<code><b><em>graph</em>.addEdge(<em>out</em>, <em>in</em>, <em>id</em>, <em>data</em>)</b></code><hr/>
Creates a new edge and returns the edge object. The edge contains the properties defined in <em>data</em>.</p>
<hr/>
<code><b><em>graph</em>.addEdge(<em>out</em>, <em>in</em>, <em>id</em>, <em>label</em>, <em>data</em>)</b></code><hr/>
Creates a new edge and returns the edge object. The edge has the label <em>label</em> and contains the properties defined in <em>data</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v1 = g.addVertex(1);
Vertex(1)
arango&gt; v2 = g.addVertex(2);
Vertex(2)
arango&gt; e = g.addEdge(v1, v2, 3);
Edge(3)
</pre></div><div class="fragment"><pre class="fragment">arango&gt; e = g.addEdge(v1, v2, 4, "1-&gt;2", { name : "Emil");
Edge(4)
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphGraphAddVertex"></a> <hr/>
<code><b><em>graph</em>.addVertex(<em>id</em>)</b></code><hr/>
Creates a new vertex and returns the vertex object. The identifier <em>id</em> must be a unique identifier or null.</p>
<hr/>
<code><b><em>graph</em>.addVertex(<em>id</em>, <em>data</em>)</b></code><hr/>
Creates a new vertex and returns the vertex object. The vertex contains the properties defined in <em>data</em>.</p>
<p><b>Examples</b><br/>
</p>
<p>Without any properties:</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex("hugo");
Vertex("hugo")
</pre></div><p>With given properties:</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex("Emil", { age : 123 });
Vertex("Emil")
arango&gt; v.getProperty("age");
123
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphGraphGetEdges"></a> <hr/>
<code><b><em>graph</em>.getEdges()</b></code><hr/>
Returns an iterator for all edges of the graph. The iterator supports the methods <code>hasNext</code> and <code>next</code>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; f = g.getEdges();
[edge iterator]
arango&gt; f.hasNext();
true
arango&gt; e = f.next();
Edge(&lt;graph&gt;, "2141724:4636053")
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphGraphGetVertex"></a> <hr/>
<code><b><em>graph</em>.getVertex(<em>id</em>)</b></code><hr/>
Returns the vertex identified by <em>id</em> or <code>null</code>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; g.addVertex(1);
Vertex(1)
arango&gt; g.getVertex(1)
Vertex(1)
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphGraphGetVertices"></a> <hr/>
<code><b><em>graph</em>.getVertices()</b></code><hr/>
Returns an iterator for all vertices of the graph. The iterator supports the methods <code>hasNext</code> and <code>next</code>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; f = g.getVertices();
[vertex iterator]
arango&gt; f.hasNext();
true
arango&gt; v = f.next();
Vertex(18364)
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphGraphRemoveVertex"></a> <hr/>
<code><b><em>graph</em>.removeVertex(<em>vertex</em>)</b></code><hr/>
Deletes the <em>vertex</em> and all its edges.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v1 = g.addVertex(1);
Vertex(1)
arango&gt; v2 = g.addVertex(2);
Vertex(2)
arango&gt; e = g.addEdge(v1, v2, 3);
Edge(3)
arango&gt; g.removeVertex(v1);
arango&gt; v2.edges();
[ ]
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphGraphRemoveEdge"></a> <hr/>
<code><b><em>graph</em>.removeEdge(<em>vertex</em>)</b></code><hr/>
Deletes the <em>edge</em>. Note that the in and out vertices are left untouched.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v1 = g.addVertex(1);
Vertex(1)
arango&gt; v2 = g.addVertex(2);
Vertex(2)
arango&gt; e = g.addEdge(v1, v2, 3);
Edge(3)
arango&gt; g.removeEdge(e);
arango&gt; v2.edges();
[ ]
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphGraphDrop"></a> <hr/>
<code><b><em>graph</em>.drop()</b></code><hr/>
Drops the graph, the vertices, and the edges. Handle with care. </p>
<h2><a class="anchor" id="JSModuleGraphVertex"></a>
Vertex Methods</h2>
<p><a class="anchor" id="JSModuleGraphVertexAddInEdge"></a> <hr/>
<code><b><em>vertex</em>.addInEdge(<em>peer</em>, <em>id</em>)</b></code><hr/>
Creates a new edge from <em>peer</em> to <em>vertex</em> and returns the edge object. The identifier <em>id</em> must be a unique identifier or null.</p>
<hr/>
<code><b><em>vertex</em>.addInEdge(<em>peer</em>, <em>id</em>, <em>label</em>)</b></code><hr/>
Creates a new edge from <em>peer</em> to <em>vertex</em> with given label and returns the edge object.</p>
<hr/>
<code><b><em>vertex</em>.addInEdge(<em>peer</em>, <em>id</em>, <em>label</em>, <em>data</em>)</b></code><hr/>
Creates a new edge from <em>peer</em> to <em>vertex</em> with given label and properties defined in <em>data</em>. Returns the edge object.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v1 = g.addVertex(1);
Vertex(1)
arango&gt; v2 = g.addVertex(2);
Vertex(2)
arango&gt; v1.addInEdge(v2, "2 -&gt; 1");
Edge("2 -&gt; 1")
arango&gt; v1.getInEdges();
[ Edge("2 -&gt; 1") ]
</pre></div><div class="fragment"><pre class="fragment">arango&gt; v1.addInEdge(v2, "D", "knows", { data : 1 });
Edge("D")
arango&gt; v1.getInEdges();
[ Edge("K"), Edge("2 -&gt; 1"), Edges("D") ]
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphVertexAddOutEdge"></a> <hr/>
<code><b><em>vertex</em>.addOutEdge(<em>peer</em>)</b></code><hr/>
Creates a new edge from <em>vertex</em> to <em>peer</em> and returns the edge object.</p>
<hr/>
<code><b><em>vertex</em>.addOutEdge(<em>peer</em>, <em>label</em>)</b></code><hr/>
Creates a new edge from <em>vertex</em> to <em>peer</em> with given <em>label</em> and returns the edge object.</p>
<hr/>
<code><b><em>vertex</em>.addOutEdge(<em>peer</em>, <em>label</em>, <em>data</em>)</b></code><hr/>
Creates a new edge from <em>vertex</em> to <em>peer</em> with given <em>label</em> and properties defined in <em>data</em>. Returns the edge object.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v1 = g.addVertex(1);
Vertex(1)
arango&gt; v2 = g.addVertex(2);
Vertex(2)
arango&gt; v1.addOutEdge(v2, "1-&gt;2");
Edge("1-&gt;2")
arango&gt; v1.getOutEdges();
[ Edge(1-&gt;2") ]
</pre></div><div class="fragment"><pre class="fragment">arango&gt; v1.addOutEdge(v2, 3, "knows");
Edge(3)
</pre></div><div class="fragment"><pre class="fragment">arango&gt; v1.addOutEdge(v2, 4, "knows", { data : 1 });
Edge(4)
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphVertexEdges"></a> <hr/>
<code><b><em>vertex</em>.edges()</b></code><hr/>
Returns a list of in- or outbound edges of the <em>vertex</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v1 = g.addVertex(1);
Vertex(1)
arango&gt; v2 = g.addVertex();
Vertex(2)
arango&gt; e = g.addEdge(v1, v2, "1-&gt;2");
Edge("1-&gt;2")
arango&gt; v1.edges();
[ Edge("1-&gt;2") ]
arango&gt; v2.edges();
[ Edge("1-&gt;2") ]
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphVertexGetId"></a> <hr/>
<code><b><em>vertex</em>.getId()</b></code><hr/>
Returns the identifier of the <em>vertex</em>. If the vertex was deleted, then <code>undefined</code> is returned.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango&gt; v.getId();
"1"
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphVertexGetInEdges"></a> <hr/>
<code><b><em>vertex</em>.getInEdges(<em>label</em>, ...)</b></code><hr/>
Returns a list of inbound edges of the <em>vertex</em> with given label(s).</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v1 = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango&gt; v2 = g.addVertex(2, { name : "Emil" });
Vertex(2)
arango&gt; e1 = g.addEdge(v1, v2, 3, "knows");
Edge(3)
arango&gt; e2 = g.addEdge(v1, v2, 4, "hates");
Edge(4)
arango&gt; v2.getInEdges();
[ Edge(3), Edge(4) ]
arango&gt; v2.getInEdges("knows");
[ Edge(3) ]
arango&gt; v2.getInEdges("hates");
[ Edge(4) ]
arango&gt; v2.getInEdges("knows", "hates");
[ Edge(3), Edge(4) ]
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphVertexGetOutEdges"></a> <hr/>
<code><b><em>vertex</em>.getOutEdges(<em>label</em>, ...)</b></code><hr/>
Returns a list of outbound edges of the <em>vertex</em> with given label(s).</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v1 = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango&gt; v2 = g.addVertex(2, { name : "Emil" });
Vertex(2)
arango&gt; e1 = g.addEdge(v1, v2, 3, "knows");
Edge(3)
arango&gt; e2 = g.addEdge(v1, v2, 4, "hates");
Edge(4)
arango&gt; v1.getInEdges();
[ Edge(3), Edge(4) ]
arango&gt; v1.getInEdges("knows");
[ Edge(3) ]
arango&gt; v1.getInEdges("hates");
[ Edge(4) ]
arango&gt; v1.getInEdges("knows", "hates");
[ Edge(3), Edge(4) ]
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphVertexGetProperty"></a> <hr/>
<code><b><em>vertex</em>.getProperty(<em>name</em>)</b></code><hr/>
Returns the property <em>name</em> a <em>vertex</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango&gt; v.getProperty("name");
Hugo
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphVertexGetPropertyKeys"></a> <hr/>
<code><b><em>vertex</em>.getPropertyKeys()</b></code><hr/>
Returns all propety names a <em>vertex</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango&gt; v.getPropertyKeys();
[ "name" ]
arango&gt; v.setProperty("email", "hugo@hugo.de");
"hugo@hugo.de"
arango&gt; v.getPropertyKeys();
[ "name", "email" ]
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphVertexProperties"></a> <hr/>
<code><b><em>vertex</em>.properties()</b></code><hr/>
Returns all properties and their values of a <em>vertex</em></p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango&gt; v.properties();
{ name : "Hugo" }
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphVertexSetProperty"></a> <hr/>
<code><b><em>vertex</em>.setProperty(<em>name</em>, <em>value</em>)</b></code><hr/>
Changes or sets the property <em>name</em> a <em>vertex</em> to <em>value</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango&gt; v.getProperty("name");
"Hugo"
arango&gt; v.setProperty("name", "Emil");
"Emil"
arango&gt; v.getProperty("name");
"Emil"
</pre></div> <h2><a class="anchor" id="JSModuleGraphEdge"></a>
Edge Methods</h2>
<p><a class="anchor" id="JSModuleGraphEdgeGetId"></a> <hr/>
<code><b><em>edge</em>.getId()</b></code><hr/>
Returns the identifier of the <em>edge</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex("v");
Vertex("v")
arango&gt; e = g.addEdge(v, v, 1, "self");
Edge(1)
arango&gt; e.getId();
1
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphEdgeGetInVertex"></a> <hr/>
<code><b><em>edge</em>.getInVertex()</b></code><hr/>
Returns the vertex at the head of the <em>edge</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v1 = g.addVertex(1);
Vertex(1)
arango&gt; e = g.addEdge(v, v, 2, "self");
Edge(2)
arango&gt; e.getInVertex();
Vertex(1)
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphEdgeGetLabel"></a> <hr/>
<code><b><em>edge</em>.getLabel()</b></code><hr/>
Returns the label of the <em>edge</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1);
Vertex(1)
arango&gt; e = g.addEdge(v, v, 2, "knows");
Edge(2)
arango&gt; e.getLabel();
knows
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphEdgeGetOutVertex"></a> <hr/>
<code><b><em>edge</em>.getOutVertex()</b></code><hr/>
Returns the vertex at the tail of the <em>edge</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1);
Vertex(1)
arango&gt; e = g.addEdge(v, v, 2, "self");
Edge(2)
arango&gt; e.getOutVertex();
Vertex(1)
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphEdgeGetProperty"></a> <hr/>
<code><b><em>edge</em>.getProperty(<em>name</em>)</b></code><hr/>
Returns the property <em>name</em> an <em>edge</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1);
Vertex(1)
arango&gt; e = g.addEdge(v, v, 2, "self", { "weight" : 10 });
Edge(2)
arango&gt; e.getProperty("weight");
10
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphEdgeGetPropertyKeys"></a> <hr/>
<code><b><em>edge</em>.getPropertyKeys()</b></code><hr/>
Returns all propety names an <em>edge</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1);
Vertex(1)
arango&gt; e = g.addEdge(v, v, 2, "self", { weight: 10 })
Edge(2)
arango&gt; e.getPropertyKeys()
[ "weight" ]
arango&gt; e.setProperty("name", "Hugo");
Hugo
arango&gt; e.getPropertyKeys()
[ "weight", "name" ]
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphEdgeProperties"></a> <hr/>
<code><b><em>edge</em>.properties()</b></code><hr/>
Returns all properties and their values of an <em>edge</em></p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1);
Vertex(1)
arango&gt; e = g.addEdge(v, v, 2, "knows");
Edge(2)
arango&gt; e.properties();
{ "weight" : 10 }
</pre></div> <hr/>
<p><a class="anchor" id="JSModuleGraphEdgeSetProperty"></a> <hr/>
<code><b><em>edge</em>.setProperty(<em>name</em>, <em>value</em>)</b></code><hr/>
Changes or sets the property <em>name</em> an <em>edges</em> to <em>value</em>.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">arango&gt; v = g.addVertex(1);
Vertex(1)
arango&gt; e = g.addEdge(v, v, 2, "self", { weight: 10 })
Edge(2)
arango&gt; e.getPropert("weight")
10
arango&gt; e.setProperty("weight", 20);
20
arango&gt; e.getPropert("weight")
20
</pre></div> </div></div>
</div></body></html>