Monday, February 28, 2011

Javascript random graphs

I'm not an expert in Javascript so I decided to practice a bit. I've done a random graph generator using HTML5 canvas functionality and I would like to share with you.


Here is some explanation:


1) Vertex Number is the numer of nodes you want.
2) Max edges numer: is the maximun number of edges of the graph (the graph may have less)
3) If an edge is an reflexible edge it will appear as "*". 
4) In a direct graph the end point of the arc is marked with a rectangle (if not directed it has no sense)
5) The weight of the edge is in the edge (if not weighted it has no sense)
6) The weight is between 20 and another number I can't remember now (I could check the code but I don't want to).
7) If you receive a message saying that the graph couldn't be created then it is because the Max edge number is to high for that particular graph.
8) I haven't done any check of empty values or text or whatever because it is boring. :-)
9) I only tested on Chrome which is my default browser (I'm not QA :-) ).
10) If "Directed Acyclic" and "Non Directed Simple Graph" are checked, then it is consider as "Directed Acyclic"


cheers!


Vertex number:
Max edges number:

Non Directed Simple Graph
Directed Acyclic
Weighted





No comments:

Post a Comment