[kepler-dev] Workflow for recursive algorithm?

Zhijie Guan guan at sdsc.edu
Fri Jan 20 11:58:50 PST 2006


Does anybody have the experience of modeling recursive process using 
Kepler workflow? Any comments/suggestions/ideas are appreciated.

Currently I am trying to model an algorithm which is similar to a tree 
traversing process. Many algorithms involving tree data structrue use 
recursion. Although theoretically any recursive function can be 
transformed into an iterative function by using a stack, it is often 
difficult to transform tree traversing algorithm because the tree may have 
unknown length. So I prefer to explore Kepler's ability of describing 

Here comes the pseudo code of the recursive algorithm:

FUNCTION recursiveDCM(tree)
 	IF tree is small enough THEN
 		subtrees[] = divideTree(tree)
 		FOR EACH subtree IN subtrees[]
 			recursiveDCM(subtree)	// Recursive call
 		finaltree = mergeTree(subtrees[])

The functions evaluateTree, divideTree, and mergeTree have been 
implemented as actors. I would like to build the function recursiveDCM as 
a workflow. I know it's pretty easy to wrap all the code into one actor 
to implement the recursion since Java itself supports recursion. But I 
would like see if Kepler can handle it.

The first method popped up in my mind is to use CompositeActors. I tested 
my idea with a simple String Concatenate workflow. I firstly built up a 
workflow which includes a StringConstant actor, a StringConcatenate actor, 
and a TextDisplay actor. They are linked as the following:

StringConstant-->InputPort1 of StringConcatenate-->TextDisplay

Then I wrapped the StringConstant and StringConcatenate actors as a 
CompositeActor. So the workflow now looks like:


Then I copied the CompositeActor, open the CompositeActor (look inside), 
and pasted the CompositeActor into the CompositeActor editing interface. 
Then within the CompositeActor editing interface, I connected the output 
of CompositeActor to another input port of the StringConcatenate actor. 
Now the inner structure of the CompositeActor looks like:

StringConstant-->InputPort1 of
                                StringConcatenate -->Outgoing port
                  InputPort2 of

I hope including a CompositeActor into itself could let me model the 
recursive process. But it does not work as I expected. I checked the 
workflow XML file, this method only adds one more layer of CompositeActor 
into workflow definition.

Does anybody have better solutions to this problem?

Thanks in advance!


More information about the Kepler-dev mailing list