Hi,
I made it. Now, there are two ways to build a DSM. First, with the DSMBuilder, seond by a small script.
Example of the first method: ===== DSMBuilder buildWithNodes: #(1 2 3 4 5 6) edges: #((1 2) (2 1) (3 1) (2 3) (4 5) (5 4) (6 4)) from: #first to: #second =====
Example of the second one: ===== |DSMAlgo dSMMatrix view| view := MOViewRenderer new. dSMMatrix := DSMMatrix withNodes: #(1 2 3 4 5 6) edges: #((1 2) (2 1) (3 1) (2 3) (4 5) (5 4) (6 4)) from:#first to:#second.
DSMVisualization new open: dSMMatrix on: view. view open =====
Cheers, Jannik
On Apr 21, 2010, at 16:50 , Simon Denier wrote:
On 21 avr. 2010, at 16:19, Tudor Girba wrote:
Hi,
That is great indeed. Jannik, thanks for spending the time to make it generic. It will be very useful.
I agree with the suggestion of Alex regarding the API. Perhaps you can build a DSMBuilder that just provides the API to populate your internal model.
While we are on it, I just want to put forward that the Graph library already comes with a generic graph builder just for this purpose (it's used for example in layer table and other places, to build graph structure with more or less arbitrary classes).
The following is the sample expression to create a basic graph.
MOGraphStructure new nodeClass: MOGraphNode; edgeClass: MOGraphEdge; nodes: #(1 2 3); edges: #((1 2) (2 1) (3 1)) from: #first to: #second.
Cheers, Doru
On 21 Apr 2010, at 15:41, Alexandre Bergel wrote:
Cool! It works for me.
dSMMatrix := DSMMatrix withNodes: #(#1 #2 #3) edges: #(#(#1 #2) #(#2 #1) #(#3 #1)).
I was wondering why not to use the Mondrian convention for specifying edges. In mondrian you can specify edges with: view edges: nodes from: #selector1 to: #selector2.
For each node contained in nodes, it creates an edge going from 'node selector1' to 'node selector2'. This is quite convenient, because I do not have to specify how each edge is defined within the script. The domain I wish to represent is in charge of defining the edges.
If you still wish to explicitly defining edges, you can always do:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= view shape rectangle size: 30; withText. view nodes: (1 to: 3). view shape arrowedLine. view edges: {1 -> 2. 2 -> 1 . 3 ->1} from: #key to: #value. view treeLayout -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Also, maybe it would be nice to have a DSMShape in Mondrian, that draw a DSM for a particular node (e.g., a group of packages). But maybe this could be quite some work to adapt your implementation.
Cheers, Alexandre
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"What is more important: To be happy, or to make happy?"
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--- Jannik Laval