Ejemplo n.º 1
0
        [NotNull] public IEnumerable <DirectedGraphEdge <T> > GetEdgesTo([NotNull] DirectedGraphNode <T> node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            if (!mEdgesToView.ContainsKey(node.Data))
            {
                yield break;
            }

            foreach (var sourceNode in mEdgesToView[node.Data])
            {
                yield return(new DirectedGraphEdge <T>(this, sourceNode, node));
            }
        }
Ejemplo n.º 2
0
        internal DirectedGraphEdge([NotNull] DirectedGraph <T> graph, [NotNull] T from, [NotNull] T to)
        {
            if (graph == null)
            {
                throw new ArgumentNullException(nameof(graph));
            }
            if (from == null)
            {
                throw new ArgumentNullException(nameof(from));
            }
            if (to == null)
            {
                throw new ArgumentNullException(nameof(to));
            }

            From = new DirectedGraphNode <T>(graph, from);
            To   = new DirectedGraphNode <T>(graph, to);
        }