Exemplo n.º 1
0
 public HaymanEdge(IHaymanVertex outVertex,
                   IHaymanVertex inVertex,
                   EdgeId id)
 {
     _outVertex = outVertex;
     _inVertex = inVertex;
     _id = id;
 }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
 public Word(Model model, string id)
 {
     _vertex = (model as IModelGraphAdapter).GetVertex(new VertexId(id));
 }
Exemplo n.º 4
0
 public Item(Model model, string id)
 {
     _model = model;
     _vertex = (model as IModelGraphAdapter).GetVertex(new VertexId(id));
 }
Exemplo n.º 5
0
 /// <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);
 }
Exemplo n.º 6
0
 public IHaymanVertex AddVertex(IHaymanVertex vertex)
 {
     _vertices.Add(vertex.Id, vertex);
     return vertex;
 }