Algorithms using FBP network diagram

47 views
Skip to first unread message

Giant Elk

unread,
Nov 8, 2015, 11:39:06 PM11/8/15
to Flow Based Programming
I'm running in circles trying to come up with a FBP diagram for: Fibonacci Sequence via recursion, and a search for a Binary tree.

Basically I want to get some FBP network diagrams going for common data structures, to help wrap my head around using FBP to build complex data structures using 'Components'.

Alfredo Sistema

unread,
Nov 8, 2015, 11:50:54 PM11/8/15
to Flow Based Programming
Don't implement algorithms for data structures with a graph, use them to route data. If you need fibonacci, just make a component that calculates it, if you need to search in a binary tree, implement a component that does it.

El lun., 9 nov. 2015 a las 1:39, Giant Elk (<flyinghor...@gmail.com>) escribió:
I'm running in circles trying to come up with a FBP diagram for: Fibonacci Sequence via recursion, and a search for a Binary tree.

Basically I want to get some FBP network diagrams going for common data structures, to help wrap my head around using FBP to build complex data structures using 'Components'.

--
You received this message because you are subscribed to the Google Groups "Flow Based Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flow-based-progra...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Humberto Madeira

unread,
Nov 9, 2015, 9:43:15 AM11/9/15
to Flow Based Programming
Hi GK,

For Fibonacci You don't need recursion - a simple loop will suffice.

Start with an indexed pair (index, a, b) with values = (0,0,1)

Feed it to a component X that creates a new indexed pair from the incoming one such that

a       <= b
b       <= b+a
index <= index+1

Feed that output to a filter - you can filter on any attribute, for example index <= 10

From the filter's "accepted" output, you will need to connect it to two places, 
so you in classic FBP you might need to implement some sort of Tee (if it doesn't already exist)

Connect one of the flows back to the input of component X

Connect the other flow to another component Y  that creates an indexed value (index, value) from the incoming indexed pair such that
index <= index
value <= a

Connect that output to wherever you want.

Note: Apologies for any deviations from Paul's FBP nomenclature (I have my own flow engine with a very different nomenclature),
Perhaps someone could fill in the gaps?

You could probably do something similar for the binary search.

Of course, it would be simpler for a programmer just to use normal coding (and the execution would be much faster)
But the above could be done visually, and IMHO could be much easier for non-programmers to understand.

Regards,
--Bert

Giant Elk

unread,
Nov 9, 2015, 11:50:16 AM11/9/15
to flow-based-...@googlegroups.com

I will attempt to put this in a flow diagram and upload here.

Re: don't use FBP for algorithms. For advanced AI type stuff would be ideal to build via network vs math.

Reply all
Reply to author
Forward
0 new messages