Unformatted text preview: The Mathematics of ForceThe
Directed Placement
Simulating Graphs as Physical Systems
To Assist in Computer Chip Layout By Jamey Lewis,
St. Michael’s College How do we convert…
How
…this… … into this?
into The Problem
The We have a graph of nodes and edges (gates and
We wires in the computer chip).
wires We need to find a good layout
We for the graph that provides a
geometric representation of its
components and makes graph
symmetry clearly visible.
symmetry In industry there may be
In constraints on the size of the
components, but they may
also simply need to be far
enough apart to distinguish.
enough The Solution
The Simulate the graph or network as a physical model
Simulate (masses and springs, for example) and subject it to
physical forces.
physical The unnecessarilylong edges
The will be the most tense, and will
try to contract the most.
try When the nodes and edges
When have pushed and pulled
themselves to equilibrium, we
will have a geometric
representation of the graph in
the plane.
the The Spring Embedder
The
A model of masses and springs, corresponding to nodes
model
and edges on a graph, is called a Spring Embedder.
and
Spring forces exist between nodes and may attract or
Spring
repel depending on how contracted they are, and on how
contracted they want to be (desired/ideal length).
contracted
Electrical forces may exist to repel nodes from one
Electrical
another, to keep them as far apart as constraints dictate, if
spring repulsion is insufficient.
spring The Spring Force
The
xv − xu
∑ E k (d ( pu , pv ) − luv ) d ( p , p )
( u , v )∈
u
v
(1)
uv The xcomponent of the Spring force equation on vertex v.
The
Spring
The ycomponent equation mirrors this one.
The force is applied to v by all springs (edges) between v
The
and another vertex.
and
k(1) : the stiffness of the spring between the two vertices
the
L : the resting length of the spring
d(p1,p2) : the linear distance between the two vertices
d(p
x : the xcoordinate of a vertex’ position The Repulsive Force
The
xv − xu
∑ (d ( p , p ))2 d ( p , p )
( u , v )∈VxV
u
v
u
v
kuv ( 2) The xcomponent of the Repulsive force equation on vertex v.
The
Repulsive
The ycomponent equation mirrors this one.
The
The force is applied to v by all other vertices (perhaps limited
to merely those within a specific effective range).
to
k(2) : electrical repulsion constant between two vertices
electrical
d(p1,p2) : the linear distance between the two vertices
d(p
x : the xcoordinate of a vertex’ position An Example
An Concerning the Barycentric Model Some Spring Embedders use a Gravitational force to attract all nodes toward the graph’s Barycenter (the average of all node positions) in order to show symmetry more clearly and keep looselyconnected groups of nodes from drifting.
Others simulate this by creating at least 3 Fixed vertices on the edges of the graph and giving all edges an ideal length of 0, causing them to want to contract as long as they are able, counteracted only by the attraction from the fixed vertices. My Implementation Instead of directly implementing simulated Gravity, I chose to use the method of setting some but not all Ideal Edge Lengths to 0.
This results in a graph that is sufficiently flexible to show off geometry, yet not unnecessarily bent towards the middle to produce a circular formation.
However, I also retained the Repulsive forces that are not present in the 2nd method, so that fixed points would not be a requirement. A Problem: Oscillation
Problem: One of the problems of Spring Embedder
One
implementation is of Oscillation, that is, when nodes
move back and forth repetitively without ever stabilizing.
move This happens because the application of forces in a
This
computer program occurs in steps and not continuously,
and moving vertices are given the chance to move past
their stable destinations in a single step, forcing them to
move back and forth.
move A form of oscillation that also occurs is Rotation, when
form
vertices continuously move in a circle.
vertices The Solution: Temperature
The A solution to this problem is to implement a
solution
“Temperature” for each vertex, acting as a factor for its
movement. Hot = fast, cold = slow.
Hot
cold When traveling continuously in the same direction, a
When
Vertex’ temperature will increase and it will speed up.
When Oscillation or Rotation are detected, the Vertex’
temperature will drop, and it will slow down.
temperature Oscillation and Temperature
Oscillation ∆yv
θ = arctan(
)
∆xv
The direction of the impulse of vertex v. After adjustment
The
based on which quadrant the movement is in, this can be
used to determine if the new direction is over 90 degrees
different from the old direction.
different
θ : the direction of the impulse of vertex v
the
Δ : the change in x or y position of vertex v
the Oscillation and Temperature
Oscillation
Tv
xv = ∆xv
100
The xcomponent of the movement of vertex v as affected
The
by Temperature.
by
The ycomponent equation mirrors this one.
Δ : the change in x position of vertex v as a result of forces
the
T : the Temperature variable of vertex v, ranging from 0100 Example
Example One More Example
One END
END
Thanks for listening! ...
View
Full
Document
This note was uploaded on 11/11/2011 for the course MATH 112 taught by Professor Jarvis during the Winter '08 term at BYU.
 Winter '08
 JARVIS
 Math

Click to edit the document details