Thanks Simon. It works, this is really really cool.
For some reason, I wasn't able to install the test in my image. I have an error (cf
screenshot). The problem comes from Monticello probably.
But I was able to browse the code directly on squeaksource. Am I the only one to
experience this?
In any case, your lib is excellent.
Cheers,
Alexandre
On 11 Jun 2010, at 05:22, Simon Denier wrote:
Ok I defined a MADisjointSets algorithm to do what you need (indeed forgets that I needed
some node with nextNodes)
See tests in MADisjointSetsTest
On 11 juin 2010, at 01:20, Alexandre Bergel wrote:
>> MOKruskal will return edges to build some trees, not the components.
>>
>> Nothing out of the box, but it's pretty easy to use MODisjointSetNode and a
graph traversal to do that.
>>
>> nodes do: [:n|
>> n makeSet ].
>> nodes do: [:n|
>> n nextNodes do: [:next |
>> n union: next ]]
>> nodes inject: Dictionary new into: [:d :n |
>> (d at: n find ifAbsentPut: [OrderedCollection new]) add: n ]
>>
>> should return a map where each value is a connected component
>
> I have no idea how to use this.
> I tried:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> | g |
> g := MOGraphStructure new.
> g nodeClass: MODisjointSetNode.
> g edgeClass: MOGraphEdge.
> g nodes: (1 to: 5).
> g edges: {1 -> 2. 2 -> 3 . 4 -> 5} from: #key to: #value.
> g nodes do: [:n|
> n makeSet ].
> g nodes do: [:n|
> n nextNodes do: [:next |
> n union: next ]].
> g nodes inject: Dictionary new into: [:d :n |
> (d at: n find ifAbsentPut: [OrderedCollection new]) add: n ]
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> There are 5 implementors of nextNodes: MASndNode, MATNodeNode, MOHitsNode,
MOLayerNode, MOTarjanNode.
>
> What should I do?
>
> Alexandre
>
>
>>
>>
>>>
>>> Doru
>>>
>>>
>>> On 10 Jun 2010, at 00:58, Alexandre Bergel wrote:
>>>
>>>> Hi!
>>>>
>>>> I haven't closely followed the status of the moose algo. I am looking
for a way to get group of interconnected nodes.
>>>>
>>>> A simple test would be:
>>>>
>>>> testCycle1
>>>> | view |
>>>> view := MOViewRenderer new.
>>>> view nodes: (1 to: 5).
>>>> view edges: {1 -> 2. 2 -> 3 . 4 -> 5} from: #key to: #value.
>>>> view treeLayout.
>>>> window := view open.
>>>>
>>>> self assert: (view root numberOfDistinctGroups = 2).
>>>> self assert: (view root distinctGroups first includesAllOf: (1 to: 3)).
>>>> self assert: (view root distinctGroups second includesAllOf: (4 to:
5)).
>>>>
>>>> Is there some material that I can use to code #numberOfDistinctGroups and
#distinctGroups ?
>>>>
>>>> Cheers,
>>>> Alexandre
>>>>
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> Moose-dev(a)iam.unibe.ch
>>>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>> --
>>>
www.tudorgirba.com
>>>
>>> "Yesterday is a fact.
>>> Tomorrow is a possibility.
>>> Today is a challenge."
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> Moose-dev(a)iam.unibe.ch
>>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> Simon
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> Moose-dev(a)iam.unibe.ch
>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> Moose-dev(a)iam.unibe.ch
>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
Simon
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev