1
0
Fork 0
arangodb/Documentation/Books/Users/Blueprint-Graphs/VertexMethods.mdpp

318 lines
6.4 KiB
Plaintext

!CHAPTER Vertex Methods
**Warning: This Chapter is Deprecated**
`vertex.addInEdge( peer, id)`
Creates a new edge from peer to vertex and returns the edge object. The identifier id must be a unique identifier or null.
`vertex.addInEdge( peer, id, label)`
Creates a new edge from peer to vertex with given label and returns the edge object.
`vertex.addInEdge( peer, id, label, data)`
Creates a new edge from peer to vertex with given label and properties defined in data. Returns the edge object.
*Examples*
arango> v1 = g.addVertex(1);
Vertex(1)
arango> v2 = g.addVertex(2);
Vertex(2)
arango> v1.addInEdge(v2, "2 -> 1");
Edge("2 -> 1")
arango> v1.getInEdges();
[ Edge("2 -> 1") ]
arango> v1.addInEdge(v2, "D", "knows", { data : 1 });
Edge("D")
arango> v1.getInEdges();
[ Edge("K"), Edge("2 -> 1"), Edges("D") ]
`vertex.addOutEdge( peer)`
Creates a new edge from vertex to peer and returns the edge object.
`vertex.addOutEdge( peer, label)`
Creates a new edge from vertex to peer with given label and returns the edge object.
`vertex.addOutEdge( peer, label, data)`
Creates a new edge from vertex to peer with given label and properties defined in data. Returns the edge object.
Examples
arango> v1 = g.addVertex(1);
Vertex(1)
arango> v2 = g.addVertex(2);
Vertex(2)
arango> v1.addOutEdge(v2, "1->2");
Edge("1->2")
arango> v1.getOutEdges();
[ Edge(1->2") ]
arango> v1.addOutEdge(v2, 3, "knows");
Edge(3)
arango> v1.addOutEdge(v2, 4, "knows", { data : 1 });
Edge(4)
`vertex.edges()`
Returns an array of in- or outbound edges of the vertex.
*Examples*
arango> v1 = g.addVertex(1);
Vertex(1)
arango> v2 = g.addVertex();
Vertex(2)
arango> e = g.addEdge(v1, v2, "1->2");
Edge("1->2")
arango> v1.edges();
[ Edge("1->2") ]
arango> v2.edges();
[ Edge("1->2") ]
`vertex.getId()`
Returns the identifier of the vertex. If the vertex was deleted, then undefined is returned.
*Examples*
arango> v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango> v.getId();
"1"
`vertex.getInEdges( label, ...)`
Returns an array of inbound edges of the vertex with given label(s).
*Examples*
arango> v1 = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango> v2 = g.addVertex(2, { name : "Emil" });
Vertex(2)
arango> e1 = g.addEdge(v1, v2, 3, "knows");
Edge(3)
arango> e2 = g.addEdge(v1, v2, 4, "hates");
Edge(4)
arango> v2.getInEdges();
[ Edge(3), Edge(4) ]
arango> v2.getInEdges("knows");
[ Edge(3) ]
arango> v2.getInEdges("hates");
[ Edge(4) ]
arango> v2.getInEdges("knows", "hates");
[ Edge(3), Edge(4) ]
`vertex.getOutEdges( label, ...)`
Returns an array of outbound edges of the vertex with given label(s).
*Examples*
arango> v1 = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango> v2 = g.addVertex(2, { name : "Emil" });
Vertex(2)
arango> e1 = g.addEdge(v1, v2, 3, "knows");
Edge(3)
arango> e2 = g.addEdge(v1, v2, 4, "hates");
Edge(4)
arango> v1.getOutEdges();
[ Edge(3), Edge(4) ]
arango> v1.getOutEdges("knows");
[ Edge(3) ]
arango> v1.getOutEdges("hates");
[ Edge(4) ]
arango> v1.getOutEdges("knows", "hates");
[ Edge(3), Edge(4) ]
`vertex.getEdges( label, ...)`
Returns an array of in- or outbound edges of the vertex with given label(s).
`vertex.getProperty( name)`
Returns the property name a vertex.
*Examples*
arango> v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango> v.getProperty("name");
Hugo
vertex.getPropertyKeys()
Returns all propety names a vertex.
*Examples*
arango> v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango> v.getPropertyKeys();
[ "name" ]
arango> v.setProperty("email", "hugo@hugo.de");
"hugo@hugo.de"
arango> v.getPropertyKeys();
[ "name", "email" ]
`vertex.properties()`
Returns all properties and their values of a vertex
*Examples*
arango> v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango> v.properties();
{ name : "Hugo" }
`vertex.setProperty( name, value)`
Changes or sets the property name a vertex to value.
*Examples*
arango> v = g.addVertex(1, { name : "Hugo" });
Vertex(1)
arango> v.getProperty("name");
"Hugo"
arango> v.setProperty("name", "Emil");
"Emil"
arango> v.getProperty("name");
"Emil"
`vertex.commonNeighborsWith( target_vertex, options)`
`vertex.commonPropertiesWith( target_vertex, options)`
`vertex.pathTo( target_vertex, options)`
`vertex.distanceTo( target_vertex, options)`
`vertex.determinePredecessors( source, options)`
`vertex.pathesForTree( tree, path_to_here)`
`vertex.getNeighbors( options)`
`vertex.measurement( measurement)`
Calculates the eccentricity, betweenness or closeness of the vertex
<!--
@anchor JSModuleGraphVertexAddInEdge
@copydetails JSF_Vertex_prototype_addInEdge
@CLEARPAGE
@anchor JSModuleGraphVertexAddOutEdge
@copydetails JSF_Vertex_prototype_addOutEdge
@CLEARPAGE
@anchor JSModuleGraphVertexEdges
@copydetails JSF_Vertex_prototype_edges
@CLEARPAGE
@anchor JSModuleGraphVertexGetId
@copydetails JSF_Vertex_prototype_getId
@CLEARPAGE
@anchor JSModuleGraphVertexGetInEdges
@copydetails JSF_Vertex_prototype_getInEdges
@CLEARPAGE
@anchor JSModuleGraphVertexGetOutEdges
@copydetails JSF_Vertex_prototype_getOutEdges
@CLEARPAGE
@anchor JSModuleGraphVertexGetEdges
@copydetails JSF_Vertex_prototype_getEdges
@CLEARPAGE
@anchor JSModuleGraphVertexGetProperty
@copydetails JSF_Vertex_prototype_getProperty
@CLEARPAGE
@anchor JSModuleGraphVertexGetPropertyKeys
@copydetails JSF_Vertex_prototype_getPropertyKeys
@CLEARPAGE
@anchor JSModuleGraphVertexProperties
@copydetails JSF_Vertex_prototype_properties
@CLEARPAGE
@anchor JSModuleGraphVertexSetProperty
@copydetails JSF_Vertex_prototype_setProperty
@CLEARPAGE
@anchor JSModuleGraphVertexCommonNeighborsWith
@copydetails JSF_Vertex_prototype_commonNeighborsWith
@CLEARPAGE
@anchor JSModuleGraphVertexCommonPropertiesWith
@copydetails JSF_Vertex_prototype_commonPropertiesWith
@CLEARPAGE
@anchor JSModuleGraphVertexPathTo
@copydetails JSF_Vertex_prototype_pathTo
@CLEARPAGE
@anchor JSModuleGraphVertexDistanceTo
@copydetails JSF_Vertex_prototype_distanceTo
@CLEARPAGE
@anchor JSModuleGraphVertexDeterminePredecessors
@copydetails JSF_Vertex_prototype_determinePredecessors
@CLEARPAGE
@anchor JSModuleGraphVertexPathesForTree
@copydetails JSF_Vertex_prototype_pathesForTree
@CLEARPAGE
@anchor JSModuleGraphVertexGetNeighbors
@copydetails JSF_Vertex_prototype_getNeighbors
@CLEARPAGE
@anchor JSModuleGraphVertexMeasurement
@copydetails JSF_Vertex_prototype_measurement
-->