summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-05-05 21:38:50 +0000
committerKarl Berry <karl@freefriends.org>2019-05-05 21:38:50 +0000
commit675266a469958f9238613ad9e8ce6ae637736923 (patch)
tree869733d71acafaa19a1ce89c0c430d475448ae03 /Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms
parent89916d9520fa753d876b1c3d0b300c91be1eb5d3 (diff)
pgf
git-svn-id: svn://tug.org/texlive/trunk@51018 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/FruchtermanReingold.lua64
-rw-r--r--Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/HuSpringElectricalFW.lua48
-rw-r--r--Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SimpleSpring.lua51
-rw-r--r--Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityCloseness.lua119
-rw-r--r--Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityDegree.lua143
5 files changed, 218 insertions, 207 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/FruchtermanReingold.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/FruchtermanReingold.lua
index 6c9677aeabb..2450bba2a20 100644
--- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/FruchtermanReingold.lua
+++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/FruchtermanReingold.lua
@@ -20,33 +20,39 @@ local Storage = require "pgf.gd.lib.Storage"
declare {
key = "spring electric no coarsen layout",
algorithm = SpringElectricNoCoarsenClass,
- preconditions = { connected = true },
+ preconditions = { connected = true },
postconditions = {fixed = true},
- summary = [[This layout uses the algorithm proposed by Fruchterman and Reingold to draw graphs."]],
-
- documentation =
- [[The Fruchterman-Reingold algorithm is one if the oldest methods
- for force-based graph drawing. It is described in:
- \begin{itemize}
- \item
- Thomas M.~J.~ Fruchterman and Edward M.~ Reingold,
- \newblock Graph Drawing by Force-directed Placement,
- \newblock \emph{Software -- practice and experience,}
- 21(1 1), 1129-1164, 1991.
- \end{itemize}
- Fruchterman and Reingold had to principles in graph drawing:
- \begin{enumerate}
- \item Vertices connected by an edge should be drawn close toa another and
- \item in general, vertices should not be drawn too close to each other.
- \end{itemize}
- The spring electric no coarsen layout uses spring forces as attractive
- forces influecing vertex pairs connected by an edge and electric forces
- as repulsive forces between all vertex pairs. The original algorithm
- also contained a frame that stopped the vertices from drifting too far
- apart, but this concept was not implemented. This algorithm will not be affected
- by coarsening. This layout was implemented
- by using the Jedi framework.
+ summary = [[
+ This layout uses the algorithm proposed by Fruchterman and Reingold to draw graphs."
+ ]],
+
+ documentation = [[
+ The Fruchterman-Reingold algorithm is one if the oldest methods
+ for force-based graph drawing. It is described in:
+ %
+ \begin{itemize}
+ \item
+ Thomas M.~J.~ Fruchterman and Edward M.~ Reingold,
+ \newblock Graph Drawing by Force-directed Placement,
+ \newblock \emph{Software -- practice and experience,}
+ 21(1 1), 1129-1164, 1991.
+ \end{itemize}
+ %
+ Fruchterman and Reingold had to principles in graph drawing:
+ %
+ \begin{enumerate}
+ \item Vertices connected by an edge should be drawn close to another and
+ \item in general, vertices should not be drawn too close to each other.
+ \end{itemize}
+ %
+ The spring electric no coarsen layout uses spring forces as attractive
+ forces influencing vertex pairs connected by an edge and electric forces
+ as repulsive forces between all vertex pairs. The original algorithm
+ also contained a frame that stopped the vertices from drifting too far
+ apart, but this concept was not implemented. This algorithm will not be
+ affected by coarsening. This layout was implemented by using the Jedi
+ framework.
]],
example =
@@ -62,14 +68,14 @@ declare {
g -- {h, i, j},
h -- {i, j},
i -- j
- };
+ };
]],
example =
[[
\graph[spring electric no coarsen layout, speed = 0.25, node distance = 0.25cm, horizontal = c to l, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, coarsen = false, maximum step = 1]{
a -> b -> c -> {d1 -> e -> f -> g -> h -> i -> {j1 -> e, j2 -> l}, d2 -> l -> m}, m -> a
- };
+ };
]]
}
@@ -80,7 +86,7 @@ declare {
--define a local time function
local time_fun_1
-function time_fun_1 (t_total, t_now)
+function time_fun_1 (t_total, t_now)
if t_now/t_total <= 0.5 then
return 0.5
else
@@ -112,7 +118,7 @@ function SpringElectricNoCoarsenClass:run()
}
-- run algorithm
- spring_electric_no_coarsen:run()
+ spring_electric_no_coarsen:run()
end
return SpringElectricNoCoarsenClass \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/HuSpringElectricalFW.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/HuSpringElectricalFW.lua
index 08ccad1308f..57cd1547b6c 100644
--- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/HuSpringElectricalFW.lua
+++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/HuSpringElectricalFW.lua
@@ -20,29 +20,31 @@ declare {
key = "jedi spring electric layout",
algorithm = HuClass,
documentation_in = "documentation_hu_layout",
- preconditions = { connected = true },
+ preconditions = { connected = true },
postconditions = {fixed = true},
- summary = "This layout uses the spring electric algorithm proposed by Hu to draw graphs.",
+ summary = "This layout uses the spring electric algorithm proposed by Hu to draw graphs.",
- documentation =
- [[The spring electric algorithm by Hu uses two kinds of forces and coarsening.
- It is described in:
- \begin{itemize}
- \item
- Yifan Hu,
- \newblock Efficient, high quality force-directed graph drawing,
- \newblock \emph{The Mathematica Journal,}
- 10(1), 37-71, 2006.
- \end{itemize}
- This algorithm uses spring forces as attractive forces between vertices
- connected by an edge and electric forces as repulsive forces between
- all vertex pairs. Hu introduces coarsening, a procedure which repeatedly
- merges vertices in order to obtain a smaller version of the graph, to
- overcome local minima. He also uses the Barnes-Hut algorithm to enhance
- the runtime of his algorithms. This algorithm is not used in this
- implementation. This layout was implemented by using the Jedi framework.
- ]],
+ documentation = [[
+ The spring electric algorithm by Hu uses two kinds of forces and coarsening.
+ It is described in:
+ %
+ \begin{itemize}
+ \item
+ Yifan Hu,
+ \newblock Efficient, high quality force-directed graph drawing,
+ \newblock \emph{The Mathematica Journal,}
+ 10(1), 37--71, 2006.
+ \end{itemize}
+ %
+ This algorithm uses spring forces as attractive forces between vertices
+ connected by an edge and electric forces as repulsive forces between
+ all vertex pairs. Hu introduces coarsening, a procedure which repeatedly
+ merges vertices in order to obtain a smaller version of the graph, to
+ overcome local minima. He also uses the Barnes-Hut algorithm to enhance
+ the runtime of his algorithms. This algorithm is not used in this
+ implementation. This layout was implemented by using the Jedi framework.
+ ]],
example =
[[
@@ -52,15 +54,15 @@ declare {
b -- {c, d, e},
c -- {d, e},
d --e
- };
- ]],
+ };
+ ]],
example =
[[
\tikz
\graph[spring electric fw layout, speed = 0.35, node distance = 1cm, horizontal = c to l, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, maximum displacement per step = 10]{
a -> b -> c -> {d1 -> e -> f -> g -> h -> i -> {j1 -> e, j2 -> l}, d2 -> l -> m}, m -> a
- };
+ };
]]
}
diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SimpleSpring.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SimpleSpring.lua
index 20a1be5de0e..4dbae2b1f4c 100644
--- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SimpleSpring.lua
+++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SimpleSpring.lua
@@ -19,35 +19,34 @@ declare {
key = "trivial spring layout",
algorithm = SimpleSpringClass,
documentation_in = "pgf.gd.doc.jedi.algorithms.SimpleSpringLayout",
- preconditions = { connected = true },
+ preconditions = { connected = true },
postconditions = {fixed = true},
- summary = "This layout uses only spring forces to draw graphs.",
+ summary = "This layout uses only spring forces to draw graphs.",
- documentation =
- [[The simple spring algorithm only uses one force kind: A spring force
- that serves as both attracitve and repuslive force. The edges are modeled as
- springs and act according to Hoke's law: They have an ideal length and will
- expand if they are contracted below this length, pushing the adjacent
- vertices away from each other, and contract if it is stretched, pulling the
- adjacent vertices towards each other. This ideal length is given by the
- parameter |node distance|. There is no force repelling vertices that are not
- connected to each other, which can lead to vertices being placed at the same
- point. It is not a very powerfull layout and will probably fail with large
- graphs, especially if they have few edges. It can however be used to
- demonstrate the effect of spring forces. This layout was implemented by using
- the Jedi framework.
- ]],
+ documentation = [[
+ The simple spring algorithm only uses one force kind: A spring force
+ that serves as both attractive and repulsive force. The edges are modeled as
+ springs and act according to Hoke's law: They have an ideal length and will
+ expand if they are contracted below this length, pushing the adjacent
+ vertices away from each other, and contract if it is stretched, pulling the
+ adjacent vertices towards each other. This ideal length is given by the
+ parameter |node distance|. There is no force repelling vertices that are not
+ connected to each other, which can lead to vertices being placed at the same
+ point. It is not a very powerful layout and will probably fail with large
+ graphs, especially if they have few edges. It can however be used to
+ demonstrate the effect of spring forces. This layout was implemented by using
+ the Jedi framework.
+ ]],
- example =
- [[
- \tikz
- \graph[simple spring layout, node distance = 3cm, speed = 2, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, coarsen = true, maximum step = 1]{
- a -- {b, c, d, e},
- b -- {c, d, e},
- c -- {d, e},
- d --e
- };
+ example = [[
+ \tikz
+ \graph[simple spring layout, node distance = 3cm, speed = 2, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, coarsen = true, maximum step = 1]{
+ a -- {b, c, d, e},
+ b -- {c, d, e},
+ c -- {d, e},
+ d --e
+ };
]]
}
@@ -69,7 +68,7 @@ function SimpleSpringClass:run()
}
-- run algorithm
- simple_spring:run()
+ simple_spring:run()
end
return SimpleSpringClass \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityCloseness.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityCloseness.lua
index 12e6c02e4bf..1c8a1bb8d91 100644
--- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityCloseness.lua
+++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityCloseness.lua
@@ -24,63 +24,64 @@ declare {
algorithm = SocialClass,
postconditions = {fixed = true},
- summary = [[This layout uses the social gravity algorithm proposed by Bannister
- with closeness mass to draw graphs.]],
+ summary = [[
+ This layout uses the social gravity algorithm proposed by Bannister
+ with closeness mass to draw graphs.
+ ]],
- documentation =
- [[Bannister et all described a social gravity algorithm that can be
- implemented with different kinds of gravity.
- It is described in:
- \begin{itemize}
- \item
- Michael J.~ Bannister and David Eppstein and Michael T~. Goodrich and
- Lowell Trott,
- \newblock Force-Directed Graph Drawing Using Social Gravity and Scaling,
- \newblock \emph{CoRR,}
- abs/1209.0748, 2012.
- \end{itemize}
- This implementation uses the closeness mass to determine the gravity of each
- vertex. There are three forces in this algorithm: A spring force as
- attractive force between vertices connected by an edge, an electric force as
- repulsive force between all vertex pairs, and a gravitational force pulling
- all vertices closer to their midpoint. The gravitational force depends on
- the social mass of a vertex, which can be determined in different ways. This
- algorithm uses the closeness mass. The closeness of a vertex $u$ is the
- reciprocal of the sum of the shortest path from $u$ to every other vertex
- $v$. The gravitational force leads to more "important" vertices ending up
- closer to the middle of the drawing, since the social mass of a vertex is
- proportinal to its importance. The social layouts work especially well on
- unconnected graphs like forests. This layout was implemented by using the
- Jedi framework.
- ]],
+ documentation = [[
+ Bannister et all described a social gravity algorithm that can be
+ implemented with different kinds of gravity.
+ It is described in:
+ %
+ \begin{itemize}
+ \item Michael J.~ Bannister and David Eppstein and Michael T~. Goodrich
+ and Lowell Trott,
+ \newblock Force-Directed Graph Drawing Using Social Gravity and Scaling,
+ \newblock \emph{CoRR,}
+ abs/1209.0748, 2012.
+ \end{itemize}
+ %
+ This implementation uses the closeness mass to determine the gravity of each
+ vertex. There are three forces in this algorithm: A spring force as
+ attractive force between vertices connected by an edge, an electric force as
+ repulsive force between all vertex pairs, and a gravitational force pulling
+ all vertices closer to their midpoint. The gravitational force depends on
+ the social mass of a vertex, which can be determined in different ways. This
+ algorithm uses the closeness mass. The closeness of a vertex $u$ is the
+ reciprocal of the sum of the shortest path from $u$ to every other vertex
+ $v$. The gravitational force leads to more "important" vertices ending up
+ closer to the middle of the drawing, since the social mass of a vertex is
+ proportional to its importance. The social layouts work especially well on
+ unconnected graphs like forests. This layout was implemented by using the
+ Jedi framework.
+ ]],
- example =
- [[
- \tikz
- \graph[social closeness layout, speed = 0.9, gravity = 0.2, node distance = 0.65cm, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, find equilibrium = true, maximum step = 5]{
- a -- a1 -- a2 -- a,
- b -- b1 -- b2 -- b,
- c -- c1 -- c2 -- c,
- d -- d1 -- d2 -- d,
- e -- e1 -- e2 -- e,
- f -- f1 -- f2 -- f,
- g -- g1 -- g2 -- g,
- h -- h1 -- h2 -- h,
- i -- i1 -- i2 -- i,
- j -- j1 -- j2 -- j,
- a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- a
- };
- ]],
+ example = [[
+ \tikz
+ \graph[social closeness layout, speed = 0.9, gravity = 0.2, node distance = 0.65cm, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, find equilibrium = true, maximum step = 5]{
+ a -- a1 -- a2 -- a,
+ b -- b1 -- b2 -- b,
+ c -- c1 -- c2 -- c,
+ d -- d1 -- d2 -- d,
+ e -- e1 -- e2 -- e,
+ f -- f1 -- f2 -- f,
+ g -- g1 -- g2 -- g,
+ h -- h1 -- h2 -- h,
+ i -- i1 -- i2 -- i,
+ j -- j1 -- j2 -- j,
+ a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- a
+ };
+ ]],
- example =
- [[
- \tikz
- \graph[social closeness layout, speed = 0.35, node distance = 0.7cm, maximum step = 5, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, radius = 1cm, gravity = 2]{
- a -- {a1 -- a2, a3},
- b -- {b1, b2 -- b3 -- b4 --{b5, b6}},
- c -- {c1--c2},
- d -- {d1, d2, d3 -- {d4, d5}, d6 --{d7, d8}}
- };
+ example = [[
+ \tikz
+ \graph[social closeness layout, speed = 0.35, node distance = 0.7cm, maximum step = 5, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, radius = 1cm, gravity = 2]{
+ a -- {a1 -- a2, a3},
+ b -- {b1, b2 -- b3 -- b4 --{b5, b6}},
+ c -- {c1--c2},
+ d -- {d1, d2, d3 -- {d4, d5}, d6 --{d7, d8}}
+ };
]]
}
@@ -93,7 +94,7 @@ function SocialClass:run()
tmp = fw_attributes[vertex]
local sum = 0
for i, w in pairs(n) do
- sum = sum + w
+ sum = sum + w
end
sum = sum / # self.ugraph.vertices
tmp.mass = 1/sum
@@ -108,21 +109,21 @@ function SocialClass:run()
social_gravity:addForce{
force_type = ForceCanvasDistance,
fun_u = function (data) return data.k/(data.d*data.d) end,
- epoch = {"after expand", "during expand"}
+ epoch = {"after expand", "during expand"}
}
social_gravity:addForce{
force_type = ForceCanvasPosition,
fun_u = function (data) return data.attributes[data.u].mass*data.attributes.options.gravity end,
- epoch = {"after expand", "during expand"}
+ epoch = {"after expand", "during expand"}
}
social_gravity:addForce{
force_type = ForceGraphDistance,
fun_u = function (data) return -data.d/(data.k*data.k) end,
n = 1,
- epoch = {"after expand", "during expand"}
+ epoch = {"after expand", "during expand"}
}
social_gravity:run()
end
-return SocialClass \ No newline at end of file
+return SocialClass
diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityDegree.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityDegree.lua
index 8e94a561871..6408349107b 100644
--- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityDegree.lua
+++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityDegree.lua
@@ -23,60 +23,63 @@ declare {
algorithm = SocialClass,
postconditions = {fixed = true},
- summary = [[This layout uses the social gravity algorithm proposed by Bannister
- with closeness mass to draw graphs.]],
-
- documentation =
- [[Bannister et all described a social gravity algorithm that can be
- implemented with different kinds of gravity.
- It is described in:
- \begin{itemize}
- \item
- Michael J.~ Bannister and David Eppstein and Michael T~. Goodrich and
- Lowell Trott,
- \newblock Force-Directed Graph Drawing Using Social Gravity and Scaling,
- \newblock \emph{CoRR,}
- abs/1209.0748, 2012.
- \end{itemize}
- This implementation uses the degree mass to determine the gravity of each
- vertex. There are three forces in this algorithm: A spring force as
- attractive force between vertices connected by an edge, an electric force as
- repulsive force between all vertex pairs, and a gravitational force pulling
- all vertices closer to their midpoint. The gravitational force depends on
- the social mass of a vertex, which can be determined in different ways. This
- algorithm uses the degree of each vertex as its mass. The gravitational
- force leads to more "important" vertices ending up closer to the middle of
- the drawing, since the social mass of a vertex is proportinal to its
- importance. The social layouts work especially well on unconnected graphs
- like forests. This layout was implemented by using the Jedi framework.
- ]],
+ summary = [[
+ This layout uses the social gravity algorithm proposed by Bannister
+ with closeness mass to draw graphs.]],
+
+ documentation = [[
+ Bannister et all described a social gravity algorithm that can be
+ implemented with different kinds of gravity.
+ It is described in:
+ %
+ \begin{itemize}
+ \item
+ Michael J.~ Bannister and David Eppstein and Michael T~. Goodrich and
+ Lowell Trott,
+ \newblock Force-Directed Graph Drawing Using Social Gravity and Scaling,
+ \newblock \emph{CoRR,} abs/1209.0748, 2012.
+ \end{itemize}
+ %
+ This implementation uses the degree mass to determine the gravity of each
+ vertex. There are three forces in this algorithm: A spring force as
+ attractive force between vertices connected by an edge, an electric force as
+ repulsive force between all vertex pairs, and a gravitational force pulling
+ all vertices closer to their midpoint. The gravitational force depends on
+ the social mass of a vertex, which can be determined in different ways. This
+ algorithm uses the degree of each vertex as its mass. The gravitational
+ force leads to more "important" vertices ending up closer to the middle of
+ the drawing, since the social mass of a vertex is proportional to its
+ importance. The social layouts work especially well on unconnected graphs
+ like forests. This layout was implemented by using the Jedi framework.
+ ]],
example =
[[
- \graph[social degree layout, speed = 0.9, gravity = 0.2, node distance = 0.65cm, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, find equilibrium = true, maximum step = 5]{
- a -- a1 -- a2 -- a,
- b -- b1 -- b2 -- b,
- c -- c1 -- c2 -- c,
- d -- d1 -- d2 -- d,
- e -- e1 -- e2 -- e,
- f -- f1 -- f2 -- f,
- g -- g1 -- g2 -- g,
- h -- h1 -- h2 -- h,
- i -- i1 -- i2 -- i,
- j -- j1 -- j2 -- j,
- a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- a
- };
- ]],
+ \tikz
+ \graph[social degree layout, speed = 0.9, gravity = 0.2, node distance = 0.65cm, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, find equilibrium = true, maximum step = 5]{
+ a -- a1 -- a2 -- a,
+ b -- b1 -- b2 -- b,
+ c -- c1 -- c2 -- c,
+ d -- d1 -- d2 -- d,
+ e -- e1 -- e2 -- e,
+ f -- f1 -- f2 -- f,
+ g -- g1 -- g2 -- g,
+ h -- h1 -- h2 -- h,
+ i -- i1 -- i2 -- i,
+ j -- j1 -- j2 -- j,
+ a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- a
+ };
+ ]],
example =
[[
- \tikz
- \graph[social degree layout, speed = 0.35, node distance = 0.7cm, maximum step = 15, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, radius = 1cm, gravity = 0.2]{
- a -- {a1 -- a2, a3},
- b -- {b1, b2 -- b3 -- b4 --{b5, b6}},
- c -- {c1--c2},
- d -- {d1, d2, d3 -- {d4, d5}, d6 --{d7, d8}}
- };
+ \tikz
+ \graph[social degree layout, speed = 0.35, node distance = 0.7cm, maximum step = 15, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, radius = 1cm, gravity = 0.2]{
+ a -- {a1 -- a2, a3},
+ b -- {b1, b2 -- b3 -- b4 --{b5, b6}},
+ c -- {c1--c2},
+ d -- {d1, d2, d3 -- {d4, d5}, d6 --{d7, d8}}
+ };
]]
}
@@ -85,30 +88,30 @@ declare {
key = "gravity",
type = "number",
initial = 0.2,
-
+
summary = "The gravity key describes the magnitude of the gravitational force.",
- documentation =
- [[
- This parameter currently only affects the \lstinline{social degree layout}
- and the \lstinline{social closeness layout}. The gravity key determines the
- strength used to pull the vertices to the center of the canvas.
- ]],
+ documentation = [[
+ This parameter currently only affects the \lstinline{social degree layout}
+ and the \lstinline{social closeness layout}. The gravity key determines the
+ strength used to pull the vertices to the center of the canvas.
+ ]],
example =
[[
- \graph[social degree layout, iterations = 100, maximum time = 100, maximum step = 10]{
- a1[weight = 2] -- {a2, a3, a4, a5},
- b1 -- {b2 -- {b3, b4}, b5}
- };
- ]],
-
- example =
- [[
- \graph[social degree layout, iterations = 100, maximum time = 100, gravity = 0.5, maximum step = 10]{
- a1 -- {a2 [mass = 2], a3, a4, a5},
- b1 -- {b2 -- {b3, b4}, b5}
- };
+ \tikz
+ \graph[social degree layout, iterations = 100, maximum time = 100, maximum step = 10]{
+ a1[weight = 2] -- {a2, a3, a4, a5},
+ b1 -- {b2 -- {b3, b4}, b5}
+ };
+ ]],
+
+ example = [[
+ \tikz
+ \graph[social degree layout, iterations = 100, maximum time = 100, gravity = 0.5, maximum step = 10]{
+ a1 -- {a2 [mass = 2], a3, a4, a5},
+ b1 -- {b2 -- {b3, b4}, b5}
+ };
]]
}
@@ -135,7 +138,7 @@ function time_fun_3 (t_total, t_now)
end
end
--- define table to store variables if needed
+-- define table to store variables if needed
local fw_attributes = Storage.newTableStorage()
function SocialClass:run()
@@ -148,7 +151,7 @@ function SocialClass:run()
-- add options to storage table
fw_attributes.options = self.ugraph.options
-
+
-- generate new force class
local social_gravity = ForceController.new(self.ugraph, fw_attributes)
@@ -174,7 +177,7 @@ function SocialClass:run()
}
-- run algorithm
- social_gravity:run()
+ social_gravity:run()
end
return SocialClass \ No newline at end of file