Skip to content

Vertex CRUD methods

ahzf edited this page May 8, 2012 · 1 revision

The following give a short overview on all vertex related methods

Vertex Events

Event Parameters Description
OnVertexAdding (graph, vertex, vote) Before a vertex is added to a graph this event will be fired which can be used to decide for or against the addition of the given vertex.
OnVertexAdded (graph, vertex) After a vertex had been added to a graph this event will be fired.

Add a vertex

Return type Method/Operator Description
Vertex graph.AddVertex(VertexInitializer = null) Add and return a vertex with an auto generated Id and the default vertex label. The optional vertex initializer will be called before the OnVertexAdding and OnVertexAdded events are called.
Vertex graph.AddVertex(Label, VertexInitializer = null) Add and return a vertex with an auto generated Id and the given vertex label. The optional vertex initializer will be called before the OnVertexAdding and OnVertexAdded events are called.
Vertex graph.AddVertex(Id, Label, VertexInitializer = null) Add and return a vertex with the given Id and vertex label. The optional vertex initializer will be called before the OnVertexAdding and OnVertexAdded events are called. If another vertex with the given Id already exists, an exception will be thrown.
Vertex graph.AddVertexIfNotExists(Id, Label, VertexInitializer = null, AnywayDo = null) Add and return a vertex with the given Id and vertex label. The optional vertex initializer will be called before the OnVertexAdding and OnVertexAdded events are called. If another vertex with the given Id already exists, the optional second delegate may be called to do some operations anyway.
Vertex graph.AddVertex(Vertex) Add and return the given vertex. If another vertex with the given Id already exists, an exception will be thrown. The OnVertexAdding and OnVertexAdded events will be called.
Vertex graph.AddVertexIfNotExists(Vertex, CheckExistanceDelegate = null) Adds the given vertex to the graph if the given check existance delegate returns true and the vertex identifier is not already being used by the graph to reference another vertex. The OnVertexAdding and OnVertexAdded events will be called.