示例#1
0
        /// <summary>
        /// Returns all Edges that connect the two nodes (which are assumed to be different).
        /// </summary>
        /// <param name="node0"></param>
        /// <param name="node1"></param>
        /// <returns></returns>
        public static IList GetEdgesBetween(Node node0, Node node1)
        {
            IList edges0      = DirectedEdge.ToEdges(node0.OutEdges.Edges);
            ISet  commonEdges = new HashedSet(edges0);
            IList edges1      = DirectedEdge.ToEdges(node1.OutEdges.Edges);

            commonEdges.RetainAll(edges1);
            return(new ArrayList(commonEdges));
        }
示例#2
0
        /// <summary>
        /// Returns all Edges that connect the two nodes (which are assumed to be different).
        /// </summary>
        /// <param name="node0"></param>
        /// <param name="node1"></param>
        /// <returns></returns>
        public static IList GetEdgesBetween(Node node0, Node node1)
        {
            var edges0   = DirectedEdge.ToEdges(node0.OutEdges.Edges);
            var edges1   = DirectedEdge.ToEdges(node1.OutEdges.Edges);
            var toRemove = edges1.Cast <Edge>().Where(edges0.Contains).ToList();

            foreach (var edge in toRemove)
            {
                edges0.Remove(edge);
            }
            return(edges0);
        }