Code Monkey home page Code Monkey logo

graph-drawing's Introduction

Introduction

no strict criteria for aesthetics

  • minimal edge crossing
  • evenly distributed vertices
  • depiction of graph symmetry

spectral method

high-dimensional embedding method

drawback

  • local minimum (improved by multilevel approach and adaptive cooling scheme)
  • computational and memory complexity

models

minimize the system energy

Force (spring-electrical models)

  • springs between neighboring (only between neighboring vertices)
  • repulsive electrical forces (proportional to the inverse of the physical distance)

$\begin{aligned} f_{r}(i, j) &=-C K^{2} /\left|x_{i}-x_{j}\right| \ f_{a}(i, j) &=\left|x_{i}-x_{j}\right|^{2} / K \end{aligned}​$

$K$: optimal distance, or natural spring length $C$: relative strength of the repulsive and attractive force

$f_r=f_a \Rightarrow d(i,j)=K(C)^{1 / 3}$ Energy ${\mathrm{se}}(x, K, C)=\sum{i \in V} f^{2}(i, x, K, C)$

Theorem 1. Let $x^{}=\left{x_{i}^{} | i \in V\right}$ minimizes $\text { Energy }{\text { se }}(x, K, C)$, then $\mathrm{sx}^{*}$minimizes Energy ${\text { se }}\left(x, K^{\prime}, C^{\prime}\right)$, where $s=\left(K^{\prime} / K\right)\left(C^{\prime} / C\right)^{1 / 3}$.

we fix $C=0.2​$.

peripheral effect

  • reason: repulsive force decays as the distance increases
  • $f_{r}(i, j)=-C K^{1+p} /\left|x_{i}-x_{j}\right|^{p}​$, $p=2​$ works well

spring model

spring attached between any two pairs of vertices

$f_{r}(i, j)=f_{a}(i, j)=\left|x_{i}-x_{j}\right|-d(i, j)​$

suffers from weak repulsive forces

Energy ${s}(x)=\sum{i \neq j, i, j \in V}\left(\left|x_{i}-x_{j}\right|-d(i, j)\right)^{2}​$

adaptive cooling scheme

$t = 0.9$

  • Increase step to step/t if the energy reduced more than 5 times in a row

  • only reduce the step length if energy increases

reference

efficient, high-quality force-directed graph drawings

quadtree and supernode

time complexity is reduced from $O(|V|^2)$ to $O(|V| \log (|V|))$

$f_{r}(i, S)=-|S| C K^{2} /\left|x_{i}-x_{S}\right|$

Barnes–Hut opening criterion: Each square is checked and recursively opened until the inequality is satisfied $$ \frac{d_{S}}{\left|x_{i}-x_{S}\right|} \leq \theta $$ where $d_S$ is the width of the square that the cluster lies in, $\theta=1.2$

CPU time measurement: $\operatorname{counts}+\alpha$ ns adaptively set max_tree _level

Graph coarsening

EC: edge collapsing

the weight of a vertex/edge is the sum of weights of vertices/edges it replaces

  • maximal matching
  • heavy-edge matching

coarsen the graph until $\frac{\left|V^{i+1}\right|}{\left|V^{i}\right|}>\rho(0.75)$

MIVS: maximal independent vertex set

result in a coarser graph with less than 50% vertices

$\gamma=\operatorname{diam}\left(G^{i}\right) / \operatorname{diam}\left(G^{i+1}\right)$,or $\gamma=\sqrt{7 / 4}$

$K^{i}=K^{i+1} / \gamma​$

only calculating the distance of two vertices u and v and their attractive/repulsive forces, if $d(u, v) \leq r(i+1)​$

cutoff radius for repulsive forces $R^{i}=r(i+1) K^{i}$

$r=4$

reference

Yifan Hu, "Efficient, High-Quality Force-Directed Graph Drawing," The Mathematica Journal

C. Walshaw, “A Multilevel Algorithm for Force-Directed Graph Drawing,” Journal of Graph Algorithms and Applications, 7(3), 2003 pp. 253–285.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.