![]() Volume 10, Issue 1 Articles Trott's Corner New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff and Contributors Submissions Subscriptions Advertising Back Issues Contact Information |
Efficient, High-Quality Force-Directed Graph Drawing
5. The Multilevel AlgorithmWhile approximation of long-range force using octree data structure greatly reduces the complexity of Algorithm 1, it does not change the fact that the algorithm repositions one vertex at a time, instead of laying out a whole region as a unit. Large graphs typically have many local minimal energy configurations, and such an algorithm is likely to settle to one of the local minimums. The adaptive step length control scheme we introduce goes some way toward a better layout, but as Figure 4 shows, is still insufficient toward a global minimum. The multilevel approach has been used in many large-scale combinatorial optimization problems, such as graph partitioning [11, 12, 23], matrix ordering [24], the traveling salesman problem [25], and has proven to be a very useful meta-heuristic tool [26]. The multilevel approach was also used in graph drawing [2, 13, 14]. In particular, Walshaw [2] was able to lay out graphs with up to 225,000 vertices in a few minutes, and largely of good quality. The multilevel approach has three distinctive phases: coarsening, coarsest graph layout, and prolongation and refinement. In the coarsening phase, a series of coarser and coarser graphs, 5.1. Graph CoarseningThere are a number of ways to coarsen an undirected graph. One frequently used method is based on edge collapsing (EC) [11, 12, 23], in which pairs of adjacent vertices are selected and each pair is coalesced into one new vertex. Each vertex of the resulting coarser graph has an associated weight, equal to the number of original vertices it represents. Each edge of the coarser graph also has a weight associated with it. Initially, all edge weights are set to 1. During coarsening, edge weights are unchanged unless both merged vertices are adjacent to the same neighbor. In this case, the new edge is given a weight equal to the sum of the weights of the edges it replaces. The edges to be collapsed are usually selected using maximal matching. This is a maximal set of edges, no two of which are incident to the same vertex. For undirected graph partitioning, heavy-edge matching has been found to work well. Here, the idea is to preferentially collapse heavier edges. When looking through a neighbor list for an unmatched vertex, an edge with the largest weight is selected. In the context of graph drawing, Walshaw [2] chose to keep vertex weights in the coarser graphs as uniform as possible by matching a vertex with a neighbor with the smallest vertex weight. We found that both heavy-edge matching and matching with a vertex of smallest weight give graph layouts of similar quality and used the former in this article. Figure 6 illustrates a graph (left) and the result (middle) of coarsening using EC. Other coarsening methods have been proposed. In [27], a maximal independent vertex set (MIVS) of a graph is chosen as the vertices for the coarser graph. An independent set of vertices is a subset of the vertices such that no two vertices in the subset are connected by an edge in the graph. An independent set is maximal if the addition of an extra vertex always destroys the independence. Edges of the coarser graph are formed by linking two vertices in MIVS by an edge if their distance apart is no greater than 3. Figure 6 illustrates a graph (left) and the result (right) of coarsening using MIVS.
Figure 6. An illustration of graph coarsening: original graph with 788 vertices (left); a coarser graph with 403 vertices resulted from EC (center); a coarser graph with 332 vertices resulted from MIVS (right). We have implemented both EC and MIVS coarsening schemes for our multilevel graph drawing algorithm. Notice that with EC, the coarse graph always has more than 50% of the vertices of the original graph. For graphs with a high average degree, it may happen that the number of vertices in the coarser graph,
We used On the other hand, for a connected graph, the MIVS coarsening usually, though not necessarily, results in a coarser graph with less than 50% of the number of vertices of the original graph. In our experience, for graph layout, EC tends to give slightly better results than MIVS, probably because it coarsens less aggressively. However, MIVS is usually faster, due to the lower complexity. To overcome the complexity issue of EC, we propose a third scheme, HYBRID. This scheme uses EC whenever possible, however, if the threshold (9) is breached, we use MIVS coarsening instead. 5.2. Initial Layout on the Coarsest GraphOn the coarsest level, we lay out the graph using Algorithm 1 combined with the adaptive step length control scheme. For MIVS and HYBRID coarsening schemes, the coarsest graph has only two vertices, thus a random placement of the two vertices would be sufficient. 5.3. The Refinement StepThe layouts on the coarser graphs are recursively prolonged to the finer graphs, with further refinement at each level. If graph Once the prolongation is carried out to give an initial layout for Although the initial layout in graph
where
Typically Therefore, for a multilevel algorithm based on the spring model, we scale the initial coordinates by the ratio of the pseudo-diameters between the two subsequent levels of graphs,
For the spring-electrical model, Walshaw [2] suggested keeping the coordinates unchanged but reducing the natural spring length
with To avoid the
Notice that the radius is larger, relative to the natural spring length, on the coarser graphs, for which a large
and by default we set
with a default 5.4. The Multilevel AlgorithmWe present the overall multilevel algorithm in the following. In the algorithm, function MultilevelLayout Algorithm 2. A multilevel force-directed algorithm. In Algorithm 2, coarsening will stop if the graph is too small,
|
||||||||
About Mathematica | Download Mathematica Player © 2006 Wolfram Media, Inc. All rights reserved. |