I'm looking for a way to draw directed graphs in PHP. (as in http://upload.wikimedia.org/wikipedia/commons/0/08/Directed_acyclic_graph.png). I want it to create an image of the graph just like GD can output an image.
I've googled a lot on this, but I only can find a lot of libraries for drawing graphs in general (with bars etc), not directed graphs.
P.S. I've tried using dot (the linux program) via system(), but unfortunately I have no permission to do that on the server. Also, I have no rights to install PHP extensions and stuff like that on the server, so it should work with normal PHP (ideally just by including a file).
Thanks in advance.
I found a PEAR interface to GraphViz; I have not used it before so can't give you any personal recommendation whether it's good or bad. (but perhaps that doesn't solve your problem since you say you can't install applications)
After a quick Google search, I found graph.php, which in the comments states that it connects nodes through arcs, vice straight lines in the example provided, but may be a good step in the right direction.
Haven't tried it yet, but this looks very promising.
http://www.kylescholz.com/blog/2006/06/using_force_directed_graphs.html
I use php to generate json that is consumed by the d3 force-directed graph system. So the display is all handled client side, all I need to do is make the right json data structures...
-FT
来源:https://stackoverflow.com/questions/850031/how-to-do-directed-graph-drawing-in-php