public HaymanEdge(IHaymanVertex outVertex, IHaymanVertex inVertex, EdgeId id) { _outVertex = outVertex; _inVertex = inVertex; _id = id; }
/// <summary> /// Add an edge to the graph. The added edges requires a recommended identifier, a tail vertex, an head vertex, and a label. /// Like adding a vertex, the provided object identifier is can be ignored by the implementation. /// </summary> /// <param name="outVertex">The vertex on the tail of the edge.</param> /// <param name="inVertex">The vertex on the head of the edge.</param> /// <param name="id">The recommended object identifier.</param> /// <param name="label">The label associated with the edge.</param> /// <param name="edgeInitializer">A delegate to initialize the new edge.</param> /// <returns> /// The newly created edge /// </returns> public IHaymanEdge AddEdge(IHaymanVertex outVertex, IHaymanVertex inVertex, EdgeId id, string label, Action<HaymanEdgeData> edgeInitializer) { var data = new HaymanEdgeData(); if (edgeInitializer != null) { edgeInitializer(data); } var edge = new HaymanEdge(outVertex, inVertex, id) { EdgeData = data }; outVertex.AddInEdge(edge); inVertex.AddOutEdge(edge); _edges.Add(id, edge); return edge; }
public Word(Model model, string id) { _vertex = (model as IModelGraphAdapter).GetVertex(new VertexId(id)); }
public Item(Model model, string id) { _model = model; _vertex = (model as IModelGraphAdapter).GetVertex(new VertexId(id)); }
/// <summary> /// Remove the provided vertex from the graph. /// Upon removing the vertex, all the edges by which the vertex is connected will be removed as well. /// </summary> /// <param name="vertex">The vertex to be removed from the graph</param> public void RemoveVertex(IHaymanVertex vertex) { _vertices.Remove(vertex.Id); }
public IHaymanVertex AddVertex(IHaymanVertex vertex) { _vertices.Add(vertex.Id, vertex); return vertex; }