/// <summary>
        /// Connects
        /// </summary>
        /// <param name="node"></param>
        /// <param name="direction"></param>
        /// <returns></returns>
        public IGraphVertex <T> ConnectNode(IGraphNode <T> node, IoDirection direction)
        {
            var vertex = this.Vertices.FirstOrDefault((x) => x.HasRelation(this, node));

            if (vertex == null)
            {
                vertex = new GraphVertex <T>(this, node, direction);
                this.RegisterVertex(vertex);
                node.RegisterVertex(vertex);
            }

            return(vertex);
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="connector">Defines the point of reference in relation to the <see cref="direction"/></param>
 /// <param name="serving">Defines the pointed instance.</param>
 /// <param name="direction">Defines the connection direction in relation to the <see cref="Connector"/> to the <see cref="Serving"/>.</param>
 public GraphVertex(IGraphNode <T> connector, IGraphNode <T> serving, IoDirection direction)
 {
     this.Connector   = connector;
     this.Serving     = serving;
     this.IoDirection = direction;
 }