Sets of all disjoint pairs of a set of even elements

Sets of all disjoint pairs of a set of even elements - Mensajes

#1 Publicado: 16/3/2016 14:54:18
frapuano

frapuano

13 me gusta en 115 mensajes.

Grupo: User

In this period I am getting crazy with the following problem.
It is related with the post of Ioan that dealt with the X-Y Plo issue.
Now I am at a point that I need to list all the possible pairs of a set of even elements (pair of nodes whose edges need to be doubled to turn the graph in an Eulerian one ).
For instance if I have a set of 4 elements : A,B,C,D the result should be the following:

(AB,CD)
(AC,BD)
(AD,BC)

so 3 sets of disjoint pair

and if I have a set of 6 elements : A,B,C,D,E,F the result should be the following:

AB,CD,EF
AB,CE,DF
AB,CF,DE

AC,BD,EF
AC,BE,DF
AC,BF,DE

AD,BC,EF
AD,BE,CF
AD,BF,CE

AE,BC,DF
AE,BD,CF
AE,BF,CD

AF,BC,DE
AF,BD,CE
AF,BE,CD

so 15 sets of disjoint pair and so on the nR of disjoint sets grows up quickly as the numeber of even element in the set increase.

I was trying to develop something iterative by myself ..but without succeding .
I have found in Internet a possible ricorsive algoritm here in delphi http://stackoverflow.com/questions/32493769/sets-of-all-disjoint-pairshttp://..but till now I was not able to turn it in something in Smath.

Everything looks stupid but turning it in an algorithm is becoming really challenging.
So I am bothering to know if someone less tired has an idea on how to do this.

Thanks in advance and best regards

Franco

#2 Publicado: 17/3/2016 15:22:20
frapuano

frapuano

13 me gusta en 115 mensajes.

Grupo: User

... make sense that a non numerical problem is not taken too much in consideration here around.

Franco
#3 Publicado: 17/3/2016 21:02:36
Davide Carpi

Davide Carpi

1.443 me gusta en 2.936 mensajes.

Grupo: Moderator

Hello Franco,

This is an attempt to translate in SMath (vs Matrices) the Delphi code (vs strings) you posted: output to canvas | encapsulated
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#4 Publicado: 17/3/2016 21:29:50
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Franco,

You will have to collect the 2nd set pairwise.
What a monkey business [don't read that comment].
You must have a real application for justifying
to spare time on this project. The complete W truss
system was done less than 3 weeks ago.

AFAIU [As Far As I Understand].

Jean

Forum Member.sm (18,86 KiB) descargado 1630 vez(es).
#5 Publicado: 18/3/2016 3:24:08
frapuano

frapuano

13 me gusta en 115 mensajes.

Grupo: User

@Joan

it is just a matter of intellectual challenge and because I am interested in graph theory.
The W truss is OK , the problem is to find a generalized algorithm for any structure.
To do this is necessary to solve - in a general way - the in between problem of assigned an even set of elements find a list ( or partition) of disjoint pairs that cover this set.
It is not a matter of drawing the pairs ( this is not the task ).
OK I know clearly that is a crazy way to solve the general problem ...but now I am on this path and I must arrive to an end.

@Davide

Thanks a lot for the help ..I was really melting my brain to try to do this , moreover I do not like recursive methods and I have tried continuously to develop an iterative solution ..with an apparent illusion to have found a solution.
You are really a wizard in turning something done in another language in a Smath piece of SW.

...now I can go ahead in the next steps of the general solution.

Thanks again and best regards

Franco

A 1 usuarios les gustó este mensaje
Davide Carpi 18/3/2016 8:20:00
#6 Publicado: 18/3/2016 8:35:03
Davide Carpi

Davide Carpi

1.443 me gusta en 2.936 mensajes.

Grupo: Moderator

You're welcome

Wrote

Thanks a lot for the help ..I was really melting my brain to try to do this , moreover I do not like recursive methods and I have tried continuously to develop an iterative solution ..with an apparent illusion to have found a solution.



In general should be always possible, however no guarantees on the complexity of the task Converting Recursion to Iteration
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#7 Publicado: 19/3/2016 0:25:51
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Thanks Davide,

Very nice "classification", will surely be useful sometimes.
Your 'for j:= ...' the construction is more than mystic.

If useful in application, can be Unested rows wise and
exploded in matrix format. For the curiosity the cyclic
rotation of vector has been added.

Cheers, Jean

Combine.sm (42,95 KiB) descargado 1619 vez(es).
A 2 usuarios les gustó este mensaje
Davide Carpi 19/3/2016 15:22:00, frapuano 19/3/2016 15:22:00
  • Nuevos mensajes
  • Sin mensajes nuevos