开发者

Layout a graph for printing on paper

Our application displays potentially big graphs with lots of nodes and edges. We use things like dot, of course, to layout the graph, and they look well on screen. However开发者_StackOverflow中文版, users would like to print them to paper. Now technically we can do it, we split the graph into little images and the users could print that. But there is no guarantee that by cutting at the page size we're not going to cut through nodes, have loads of edges between different pages, etc. I'm looking for an algorithm that would alter the layout of the graph so that it'd be more usable on printing: - ensure no node will fall on page boundaries - try to minimize edges between pages It seems that looks like finding "clusters" of densely related nodes to put on the same page with few edges crossing to other pages to other clusters. Can anybody point me to relevant literature/tools to do this kind of things?

Thanks


A cluster analysis is a good start.

I would suggest the following way to process:

First define a cost function:

Given a page repartition : Cost(Repartition) = f(nodes near boundaries, multipages-edges)

THe objective will be to minimize this function.

chose a cluster analysis algorithm:

define a cluster algorithm (you can have a look at my post on DBSCAN : DBSCAN code in C# or vb.net , for Cluster Analysis and add a "page" constraint to the clustering. (size of the page)

Depending on order you will go through your points the outcome will be different because of the "page constraint".

chose the one with the smallest cost, or stop when you find a acceptable cost.

The complexity of this algorithm would be O(n!) ... kind of big for big graphs. Therefore you need to think of some more clustering constraints, or just make a partial search (test the n2 first to have it in O(n2)) to get a good approximation. Depending of the acceptable cost you can get a result in an reasonnable time or not.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜