here is one of the assignments i liked to be doing in Scientific Computing

specifically a Mathematical Programming assignment

i could have just implemented a Console application running the algorithm and get my marks, but thats not what i need from SC Dept 🙂

i think it would be useful for those who want to learn one of the algorithms it runs or for those who want to see what a SC assignment looks like 😛

well here is the main form

as you can see the form is divided into two parts the settings part and the drawing panel

in the settings part you’ll find all the data about your Graph the Nodes, their positions and algorithm specific information as the start and end nodes of the algorithm – if it needs –

to draw a graph you should first add the nodes of the graph, by just writing the name of the node and press “Add Node”

You can enter as long name as you like but i doubt that all the name will appear on the drawn graph, (you’ll see what i mean now)

and after you add it it will be drawn in the drawing area

as in the next figure i’ve added some nodes

note that when i added the nodes their names appeared in the upper-leftmost list A,B,C,D and End

and on the drawing panel only one node is shown

that’s because all the nodes are drawn in that location

you can move the node by whatever drag-drop , select it and double click anywhere on the drawing panel and it will appear there

or you can select it and edit it’s X.Pos & Y.Pos here

but make sure when a node is selected it’s name is written in this textbox and it is highlighted in the list

after you move the Nodes to another positions now you should set the edges between the nodes

in the algorithm specific part you’ll find a hyperlink “Manage Weights”

click it and another form containing the adjacency matrix will show up

a “0” means no connection

here you can enter the weights of the edges between the nodes

in some algorithms which operate on nondirected graphs where the direction won’t matter u’ll find this form makes itself symmetric whenever you enter a value

as when you enter the value from “A” to “B” you’ll find the same value Automatically written from “B” to “A”

then…

after you enter the whights just close the form and the graph will be drawn

like this

note that the number written above each node is it’s weight , cost or whatever, according to the algorithm.

and the red number on the edges is it’s weight ( the numbers you entered in the adjacency matrix form -don’t they look familiar 😀 – )

and this is how it looks like for the algorithms that use Directed edges

then what you should do now is keep clicking the ‘Next Step” button till the algorithm finishes

but first some algorithms need to have the start and end Nodes specified like Dijkstra and Max Flow

this is the Shortest path between “A” and “C” after some “Next Step” clicks 🙂

“The black Edges are the path”

and the number written above the “C” Node – which is not visible 😀 – is the total cost to get there form “A” i guess it’ll be 31.8 or you can move the node and see it 😀

you can get the program from my box and watch the other algorithms

you can move between algorithms by clicking those arrows

you’ll find Dijkstra , Kruskal MST , Prim MST and Ford Fulkerson Max Flow algorithms implemented

you can also save the graph to a file and load it again anytime

and about that slider on the top left of the drawing panel 😐

why would anybody place a slider on a drawing panel ?!!!!!

of course it is a zoom control !! 😐 , 😐 -sort of… 😀 –

i think i’ll write how to implement your algorithm in this project soon isA

ah ..

I Forgot……

it uses framework 3.5 to run 😀

Happy Eid 🙂 , 🙂

So it’s FCIS third year, ha?!! « Jaqoup's Weblog

Jun 26, 2011@ 15:06:10