Velocity Reviews > Perl > pairs to tree

# pairs to tree

George Mpouras
Guest
Posts: n/a

 04-04-2012
I am re-thinking an old graph problem . Any idea of how to build e.g. the
tree

a
b
e
f
c
d
t
t
a
f
a

from the pairs ?

f,a
t,a
d,t
b,e
b,f
a,c
a,d
a,b

Tim McDaniel
Guest
Posts: n/a

 04-04-2012
In article <jlho10\$49i\$(E-Mail Removed)>,
George Mpouras <(E-Mail Removed)> wrote:
>I am re-thinking an old graph problem . Any idea of how to build
>e.g. the tree
>
>a
> b
> e
> f
> c
> d
> t
>t
> a
>f
> a
>
>from the pairs ?
>
>f,a
>t,a
>d,t
>b,e
>b,f
>a,c
>a,d
>a,b

I'm curious: for what class is this a homework problem?

Also, I don't see the specification. The pairs are
parent,child
and it even appears to be bottom-up.

But sometimes it's shown as transitive, like how
b,e
a,b
resulted in
a
b
e

But
t,a
d,t
does not result in
d
t
a
t
a
is itself a side tree.

--
Tim McDaniel, http://www.velocityreviews.com/forums/(E-Mail Removed)

George Mpouras
Guest
Posts: n/a

 04-04-2012
order is not important. pairs are unique. it is about building topology maps.

Tim McDaniel
Guest
Posts: n/a

 04-04-2012
In article <jlhrbs\$p5o\$(E-Mail Removed)>,
Tim McDaniel <(E-Mail Removed)> wrote:
>In article <jlho10\$49i\$(E-Mail Removed)>,
>George Mpouras <(E-Mail Removed)> wrote:
>>I am re-thinking an old graph problem . Any idea of how to build
>>e.g. the tree
>>
>>a
>> b
>> e
>> f
>> c
>> d
>> t
>>t
>> a
>>f
>> a
>>
>>from the pairs ?
>>
>>f,a
>>t,a
>>d,t
>>b,e
>>b,f
>>a,c
>>a,d
>>a,b

>
>I'm curious: for what class is this a homework problem?
>
>Also, I don't see the specification. The pairs are
> parent,child
>and it even appears to be bottom-up.
>
>But sometimes it's shown as transitive, like how
> b,e
> a,b
>resulted in
>a
> b
> e
>
>But
> t,a
> d,t
>does not result in
> d
> t
> a
>t
> a
>is itself a side tree.

> order is not important. pairs are unique. it is about building
> topology maps.

I'm usually fond of trimming unneeded text, but for someone on a
newsgroup, trimming ALL context and background is not so good.

I'm sorry, but you did not answer my questions. Expanding a bit:

But sometimes it's shown as transitive, like how
b,e
a,b
results in
a
b
e

But
t,a
d,t
a,d
does not result in
a
d
t
a
a
d
and
t
a
in two separate trees. Why? How is the program supposed to know what
to do?

--
Tim McDaniel, (E-Mail Removed)

Marc Girod
Guest
Posts: n/a

 04-11-2012
On Apr 4, 8:25*pm, "George Mpouras"
<(E-Mail Removed)> wrote:
> order is not important. pairs are unique. it is about building topology maps.

I have the same problem as Tim to understand your question.
There are even cycles...

t -> a -> d -> t
f -> a -> b -> f

Marc