I need to draw a figure of a graph(data structure).
I can't get the whole graph all at once. Eachtime I get a pair of
points,they indicate an edge and two
vertexes of the graph.
It's easy to store the graph. But I don't know how to get a rational
layout of the graph,so that the figure looks symmetrical and
balanced.
Another difficult problem(to me) is how to reduce cross-lines.
Any suggestion will be highly appreciated. Thanks in advance!
You've just discovered the problem generally called "graph layout".
There's quite some literature about it, but for starters you'll want to
look into prebuilt tools, like GraphViz
For a start, look into:
http://en.wikipedia.org/wiki/DOT_language
If however, you want to write your own graph layout routines (good
luck on that),
you will have to rummage e.g. www.citeseer.com (free) or the ACM
archives (not
free) for academical papers on the foundations. You are trying to
tackle a very
hard problem in computation so expect this to be a journey possibly
without
a destination.
regards,
Mark