1 страниц (7 вхождений)
Sets of all disjoint pairs of a set of even elements - Сообщения
#1 Опубликовано: 16.03.2016 14:54:18

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 Опубликовано: 17.03.2016 15:22:20

Franco
#3 Опубликовано: 17.03.2016 21:02:36
Hello Franco,
This is an attempt to translate in SMath (vs Matrices) the Delphi code (vs strings) you posted: output to canvas | encapsulated
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 Опубликовано: 17.03.2016 21:29:50
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 КиБ) скачан 41 раз(а).
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 КиБ) скачан 41 раз(а).
#5 Опубликовано: 18.03.2016 03:24:08
@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
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
1 пользователям понравился этот пост
Davide Carpi 18.03.2016 08:20:00
#6 Опубликовано: 18.03.2016 08:35:03
You're welcome 
In general should be always possible, however no guarantees on the complexity of the task Converting Recursion to Iteration

WroteThanks 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 Опубликовано: 19.03.2016 00:25:51
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 КиБ) скачан 46 раз(а).
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 КиБ) скачан 46 раз(а).
2 пользователям понравился этот пост
1 страниц (7 вхождений)
-
Новые сообщения
-
Нет новых сообщений