Beispiel #1
0
        /// Identifies two nodes so they become one node.
        /// \param u A node of the original graph (this includes nodes of the adaptor).
        /// \param v Another node of the original graph (this includes nodes of the adaptor).
        /// \return The object representing the merged node. Return value will be either \e u or \e v.
        public Node Merge(Node u, Node v)
        {
            var x = nodeGroups.WhereIs(u);
            var y = nodeGroups.WhereIs(v);

            if (x.Equals(y))
            {
                return(x.Representative);
            }
            unionCount++;
            return(nodeGroups.Union(x, y).Representative);
        }