1

Problem: Display a graph such that the lines drawn aren't too long and all over the place.

Solution: Set up some initial position of the points. Consider the points point masses with a charge. The connections are Hookean springs. Then, apply Newton's laws and some drag and let the system settle into some local minimum.

Example implementation: here (in the grey faces - connect and see how they move). I also set up a version with different connection weights here to solve a completely different problem - finding some similarity measure between objects that takes into account transitive connections (i.e., A is related to C, even though there is little or no connection between them, because they are connected to a common element B).

Question: I'm sure that I have already seen this demonstration many times, but I don't know what to search for. Does this algorithm (or something like it) have a name?

Guy Coder
  • 24,501
  • 8
  • 71
  • 136
Kotlopou
  • 415
  • 3
  • 13
  • Of interest: Cytoscape [layout options](https://blog.js.cytoscape.org/2020/05/11/layouts/#choice-of-layout) – Guy Coder Jul 29 '21 at 10:36

1 Answers1

2

The keyword turns out to be Force-directed graph drawing.

Kotlopou
  • 415
  • 3
  • 13