On 10 juin 2010, at 20:29, Tudor Girba wrote:
Do I understand correctly that you are looking for
identifying connected components?
In this case, you probably want the MOKruskal algorithm. Take a look at the description
here:
http://www.moosetechnology.org/tools/moosealgos/graph
Simon, am I right?
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
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