Hi
Alexandre, I tried what you sent, very nice it is.
I've added
interationSendToEvent: to the package.
For the laggered tree, I know
how to easily avoid crossing, but I need to know fo each node if it's on
the lower or the upper layer. And the ROElement don't know that.
I've
tried some little things with generic graphs, now all the compact trees
accept generic graphs, I mean graphs with cycle and forests. You just
have to give a root to your layout.
But there's a problem, what to do
with unreachable nodes ? For instance I put them on the side, but if you
have another ideé tell me.
++++++++++++++++++++++++++++
Gofer it
smalltalkhubUser: 'MathieuDehouck' project: 'RoassalAlgorithm';
package: 'Roassal-Algotithm';
load.
++++++++++++++++++++++++++++
| rawView view group listOfNodes listOfLinks layout |
rawView :=
ROView new.
view := ROMondrianViewBuilder view: rawView.
"enter your
script below"
"-------------"
"-------------"
group := Dictionary new.
"Creation of the group"
listOfNodes := #(#('Myriel' 1) #('Napoleon' 1)
#('MlleBaptistine' 1) #('MmeMagloire' 1) #('CountessdeLo' 1)
#('Geborand' 1) #('Champtercier' 1) #('Cravatte' 1)
#('Count' 1)
#('OldMan' 1) #('Labarre' 2) #('Valjean' 2) #('Marguerite'
3) #('MmedeR'
2) #('Isabeau' 2) #('Gervais' 2) #('Tholomyes' 3)
#('Listolier' 3)
#('Fameuil' 3) #('Blacheville' 3) #('Favourite' 3)
#('Dahlia' 3)
#('Zephine' 3) #('Fantine' 3) #('MmeThenardier' 4)
#('Thenardier' 4)
#('Cosette' 5) #('Javert' 4) #('Fauchelevent' 0)
#('Bamatabois' 2)
#('Perpetue' 3) #('Simplice' 2) #('Scaufflaire' 2)
#('Woman1' 2)
#('Judge' 2) #('Champmathieu' 2) #('Brevet' 2)
#('Chenildieu' 2)
#('Cochepaille' 2) #('Pontmercy' 4) #('Boulatruelle' 6)
#('Eponine' 4)
#('Anzelma' 4) #('Woman2' 5) #('MotherInnocent' 0)
#('Gribier' 0)
#('Jondrette' 7) #('MmeBurgon' 7) #('Gavroche' 8)
#('Gillenormand' 5)
#('Magnon' 5) #('MlleGillenormand' 5) #('MmePontmercy' 5)
#('MlleVaubois' 5) #('LtGillenormand' 5) #('Marius' 8)
#('BaronessT' 5)
#('Mabeuf' 8) #('Enjolras' 8) #('Combeferre' 8)
#('Prouvaire' 8)
#('Feuilly' 8) #('Courfeyrac' 8) #('Bahorel' 8)
#('Bossuet' 8) #('Joly'
8) #('Grantaire' 8) #('MotherPlutarch' 9) #('Gueulemer' 4)
#('Babet' 4)
#('Claquesous' 4) #('Montparnasse' 4) #('Toussaint' 5)
#('Child1' 10)
#('Child2' 10) #('Brujon' 4) #('MmeHucheloup' 8)).
listOfNodes do: [
:pair | group at: pair second put: pair first ].
listOfLinks := #( #(1
0 1) #(2 0 8) #(3 0 10) #(3 2 6) #(4 0 1) #(5 0 1) #(6 0 1) #(7 0 1) #(8
0 2) #(9 0 1) #(11 10 1) #(11 3 3) #(11 2 3) #(11 0 5) #(12 11 1) #(13
11 1) #(14 11 1) #(15 11 1) #(17 16 4) #(18 16 4) #(18 17 4) #(19 16 4)
#(19 17 4) #(19 18 4) #(20 16 3) #(20 17 3) #(20 18 3) #(20 19 4) #(21
16 3) #(21 17 3) #(21 18 3) #(21 19 3) #(21 20 5) #(22 16 3) #(22 17 3)
#(22 18 3) #(22 19 3) #(22 20 4) #(22 21 4) #(23 16 3) #(23 17 3) #(23
18 3) #(23 19 3) #(23 20 4) #(23 21 4) #(23 22 4) #(23 12 2) #(23 11 9)
#(24 23 2) #(24 11 7) #(25 24 13) #(25 23 1) #(25 11 12) #(26 24 4) #(26
11 31) #(26 16 1) #(26 25 1) #(27 11 17) #(27 23 5) #(27 25 5) #(27 24
1) #(27 26 1) #(28 11 8) #(28 27 1) #(29 23 1) #(29 27 1) #(29 11 2)
#(30 23 1) #(31 30 2) #(31 11 3) #(31 23 2) #(31 27 1) #(32 11 1) #(33
11 2) #(33 27 1) #(34 11 3) #(34 29 2) #(35 11 3) #(35 34 3) #(35 29 2)
#(36 34 2) #(36 35 2) #(36 11 2) #(36 29 1) #(37 34 2) #(37 35 2) #(37
36 2) #(37 11 2) #(37 29 1) #(38 34 2) #(38 35 2) #(38 36 2) #(38 37 2)
#(38 11 2) #(38 29 1) #(39 25 1) #(40 25 1) #(41 24 2) #(41 25 3) #(42
41 2) #(42 25 2) #(42 24 1) #(43 11 3) #(43 26 1) #(43 27 1) #(44 28 3)
#(44 11 1) #(45 28 2) #(47 46 1) #(48 47 2) #(48 25 1) #(48 27 1) #(48
11 1) #(49 26 3) #(49 11 2) #(50 49 1) #(50 24 1) #(51 49 9) #(51 26 2)
#(51 11 2) #(52 51 1) #(52 39 1) #(53 51 1) #(54 51 2) #(54 49 1) #(54
26 1) #(55 51 6) #(55 49 12) #(55 39 1) #(55 54 1) #(55 26 21) #(55 11
19) #(55 16 1) #(55 25 2) #(55 41 5) #(55 48 4) #(56 49 1) #(56 55 1)
#(57 55 1) #(57 41 1) #(57 48 1) #(58 55 7) #(58 48 7) #(58 27 6) #(58
57 1) #(58 11 4) #(59 58 15) #(59 55 5) #(59 48 6) #(59 57 2) #(60 48 1)
#(60 58 4) #(60 59 2) #(61 48 2) #(61 58 6) #(61 60 2) #(61 59 5) #(61
57 1) #(61 55 1) #(62 55 9) #(62 58 17) #(62 59 13) #(62 48 7) #(62 57
2) #(62 41 1) #(62 61 6) #(62 60 3) #(63 59 5) #(63 48 5) #(63 62 6)
#(63 57 2) #(63 58 4) #(63 61 3) #(63 60 2) #(63 55 1) #(64 55 5) #(64
62 12) #(64 48 5) #(64 63 4) #(64 58 10) #(64 61 6) #(64 60 2) #(64 59
9) #(64 57 1) #(64 11 1) #(65 63 5) #(65 64 7) #(65 48 3) #(65 62 5)
#(65 58 5) #(65 61 5) #(65 60 2) #(65 59 5) #(65 57 1) #(65 55 2) #(66
64 3) #(66 58 3) #(66 59 1) #(66 62 2) #(66 65 2) #(66 48 1) #(66 63 1)
#(66 61 1) #(66 60 1) #(67 57 3) #(68 25 5) #(68 11 1) #(68 24 1) #(68
27 1) #(68 48 1) #(68 41 1) #(69 25 6) #(69 68 6) #(69 11 1) #(69 24 1)
#(69 27 2) #(69 48 1) #(69 41 1) #(70 25 4) #(70 69 4) #(70 68 4) #(70
11 1) #(70 24 1) #(70 27 1) #(70 41 1) #(70 58 1) #(71 27 1) #(71 69 2)
#(71 68 2) #(71 70 2) #(71 11 1) #(71 48 1) #(71 41 1) #(71 25 1) #(72
26 2) #(72 27 1) #(72 11 1) #(73 48 2) #(74 48 2) #(74 73 3) #(75 69 3)
#(75 68 3) #(75 25 3) #(75 48 1) #(75 41 1) #(75 70 1) #(75 71 1) #(76
64 1) #(76 65 1) #(76 66 1) #(76 63 1) #(76 62 1) #(76 48 1) #(76 58
1)).
view shape circle size: 8.
view nodes: (listOfNodes collect:
#first).
view
edges: listOfLinks
from: [ :triple | (listOfNodes at:
(triple first + 1)) first ]
to: [ :triple | (listOfNodes at: (triple
second + 1)) first].
layout := ROVerticalCompactTree new.
layout
root:( view nodes at: 65).
layout initialLayout:
ROVerticalLineLayout.
view layout: layout.
view applyLayout.
view edges
do: [ :e| e ].
ROEaselMorphic new populateMenuOn: view.
view open
+++++++++++++++++++++++++
If you take off the roo: it won't work.
Regards
Mathieu