Re: transitive closure of a graph

From: vc <boston103_at_hotmail.com>
Date: 12 Oct 2005 14:47:22 -0700
Message-ID: <1129153642.729601.182820_at_g43g2000cwa.googlegroups.com>


Mikito Harakiri wrote:
> Adam Machanic wrote:
> > "Mikito Harakiri" <mikharakiri_nospaum_at_yahoo.com> wrote in message
> > news:1129086273.571304.231100_at_f14g2000cwb.googlegroups.com...
> > >
> > > If I see the problem correctly, here is step-by-step execution
> > >
> > > 1.
> > > AE, EA, AB, BA, CD, DC, BE, EB, CE, EC -- all included;
> > > the other edges in the candidate set
> > > AA, BB, CC, DD, EE -- all excluded as invalidating tail <> head
> > > predicate
> > >
> > > 2. AE+EB=AB, AE+EC=AC, ..., AD, DA, AC, CA, BD, DB, BC, CB, -- all
> > > included;
> >
> > Assume the following recursive CTE:
> >
> > with TransClosedEdges (point1, point2) as
> > ( select point1, point2 from Edges
> > where point1 <> point2
> > union all
> > select e.point1, ee.point2 from Edges e, TransClosedEdges ee
> > where e.point2 = ee.point1
> > and e.point1 <> ee.point2
> > )
> > select distinct * from TransClosedEdges
> >
> > What actually happens is:
> >
> > 1.
> > AE, EA, AB, BA, CD, DC, BE, EB, CE, EC -- all included;
> +ED, DE

>

> >
> > 2. For each anchor row, the recursive part is called. We'll follow the AE
> > row, and then only follow one other row from each recursive part:
> > - AE is used as anchor
> > - AB, ED
> > - AB is used as anchor
> > - BE, BA
> > - BE is used as anchor
> > - EA, EB
> > - EA is uned as anchor
> > - AE, AB
>

> I dont't understand this explanation at all.

The explanation does not make sense, that's true.

>

> On the other hand, it is obvious, that the union semantics would have
> taken care of the problem automatically, so that even my very first
> solution doesn't need any correction.

No, it would not. Received on Wed Oct 12 2005 - 23:47:22 CEST

Original text of this message