C# – Designing Algorithm Flowchart Application

algorithmscflowchart

I need to develop an GUI application in C# where users can freely add conditional/statement blocks on the algorithm flowchart like the one shown below. By freely, I mean users can add a block on wherever the arrows are.

I'm having some problems brainstorming how to approach this problem, especially what to choose for my datastructure to store the blocks. I was thinking LinkedList since everything follows a linear fashion and every node always has a head and tail, but the If/Else block (b>a) has two branches (heads) to store, so this complicates things a little bit.

How would a smart one approach problems like this? My apologies if this question isn't suited for Programmers stackexchange, but this is more of a conceptual problem rather than implementation problem so I figured this place was appropriate for the question.

enter image description here

Best Answer

I'd use a graph data structure. They are often implemented using adjacency matrices or adjacency lists. The MSDN has a pretty solid tutorial. The article covers both of the aforementioned structures.

Related Topic