diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated')
6 files changed, 83 insertions, 83 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Cluster.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Cluster.lua index 0b8d9e324fb..d7baed45daa 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Cluster.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Cluster.lua @@ -12,7 +12,7 @@ ---- The Cluser class defines a model of a cluster inside a graph. +--- The Cluster class defines a model of a cluster inside a graph. -- -- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Edge.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Edge.lua index 7d6369d2bc9..7355597955e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Edge.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Edge.lua @@ -43,7 +43,7 @@ Edge.NONE = "-!-" -- |nodes|: TODO \par -- |edge_nodes|: TODO \par -- |options|: TODO \par --- |tikz_options|: TODO \par +-- |tikz_options|: TODO \par -- |direction|: TODO \par -- |bend_points|: TODO \par -- |bend_nodes|: TODO \par @@ -90,14 +90,14 @@ end --- Returns the value of the edge option \meta{name}. -- -- @param name Name of the option. --- @param graph If this optional argument is given, --- in case the option is not set as a node parameter, +-- @param graph If this optional argument is given, +-- in case the option is not set as a node parameter, -- we try to look it up as a graph parameter. -- -- @return The value of the edge option \meta{name} or |nil|. -- function Edge:getOption(name, graph) - return lib.lookup_option(name, self, graph) + return lib.lookup_option(name, self, graph) end @@ -134,7 +134,7 @@ end --- Returns all nodes of the edge. -- --- Instead of calling |edge:getNodes()| the nodes can alternatively be +-- Instead of calling |edge:getNodes()| the nodes can alternatively be -- accessed directly with |edge.nodes|. -- -- @return All edges of the node. @@ -168,11 +168,11 @@ end ---- Gets first neighbour of the node (disregarding hyperedges). +--- Gets first neighbor of the node (disregarding hyperedges). -- --- @param node The node which first neighbour should be returned. +-- @param node The node which first neighbor should be returned. -- --- @return The first neighbour of the node. +-- @return The first neighbor of the node. -- function Edge:getNeighbour(node) if node == self.nodes[1] then @@ -199,7 +199,7 @@ function Edge:getHead() -- of <- edges is the first node local head_index = (self.direction == Edge.LEFT) and 1 or #self.nodes - -- if the edge should be assumed reversed, we simply switch head and + -- if the edge should be assumed reversed, we simply switch head and -- tail positions if self.reversed then head_index = (head_index == 1) and #self.nodes or 1 @@ -230,9 +230,9 @@ end -- -- This method only works for edges with two adjacent nodes. -- --- Edges may be reversed internally, so their head and tail might be switched. --- Whether or not this internal reversal is handled by this method --- can be specified with the optional second \meta{ignore\_reversed} parameter +-- Edges may be reversed internally, so their head and tail might be switched. +-- Whether or not this internal reversal is handled by this method +-- can be specified with the optional second \meta{ignore\_reversed} parameter -- which is |false| by default. -- -- @param node The node to check. @@ -246,7 +246,7 @@ function Edge:isHead(node) -- of <- edges is the first node local head_index = (self.direction == Edge.LEFT) and 1 or #self.nodes - -- if the edge should be assumed reversed, we simply switch head and + -- if the edge should be assumed reversed, we simply switch head and -- tail positions if self.reversed then head_index = (head_index == 1) and #self.nodes or 1 @@ -267,8 +267,8 @@ end -- This method only works for edges with two adjacent nodes. -- -- Edges may be reversed internally, so their head and tail might be switched. --- Whether or not this internal reversal is handled by this method --- can be specified with the optional second \meta{ignore\_reversed} parameter +-- Whether or not this internal reversal is handled by this method +-- can be specified with the optional second \meta{ignore\_reversed} parameter -- which is |false| by default. -- -- @param node The node to check. @@ -279,7 +279,7 @@ end -- function Edge:isTail(node, ignore_reversed) local result = false - + -- by default, the tail of -> edges is the first node and the tail -- of <- edges is the last node local tail_index = (self.direction == Edge.LEFT) and #self.nodes or 1 @@ -338,7 +338,7 @@ function Edge:__tostring() result = result .. table.concat(node_strings, ', ') end --return result .. ")" - + -- Note: the following lines generate a shorter string representation -- of the edge that is more readable and can be used for debugging. -- So please don't remove this: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Graph.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Graph.lua index 23712278990..161b89fd15d 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Graph.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Graph.lua @@ -127,9 +127,9 @@ function Graph:addNode(node) if not self:findNode(node.name) then -- Does the node have an index, yet? if not node.index then - node.index = #self.nodes + 1 + node.index = #self.nodes + 1 end - + table.insert(self.nodes, node) end end @@ -143,8 +143,8 @@ end -- @return The removed node or |nil| if it was not found in the graph. -- function Graph:removeNode(node) - local _, index = lib.find(self.nodes, function (other) - return other.name == node.name + local _, index = lib.find(self.nodes, function (other) + return other.name == node.name end) if index then table.remove(self.nodes, index) @@ -170,7 +170,7 @@ end --- Looks up the first node for which the function \meta{test} returns |true|. -- --- @param test A function that takes one parameter (a |Node|) and returns +-- @param test A function that takes one parameter (a |Node|) and returns -- |true| or |false|. -- -- @return The first node for which \meta{test} returns |true|. @@ -183,7 +183,7 @@ end --- Like removeNode, but also deletes all adjacent edges of the removed node. -- --- This function also removes the deleted adjacent edges from all neighbours +-- This function also removes the deleted adjacent edges from all neighbors -- of the removed node. -- -- @param node The node to be deleted together with its adjacent edges. @@ -293,7 +293,7 @@ end ---- Creates and adds a new edge to the graph. +--- Creates and adds a new edge to the graph. -- -- @param first_node The first node of the new edge. -- @param second_node The second node of the new edge. @@ -305,7 +305,7 @@ end -- \item |Edge.BOTH| and -- \item |Edge.NONE| (for invisible edges). -- \end{itemize} --- @param edge_nodes A string of \tikzname\ edge nodes that needs to be passed +-- @param edge_nodes A string of \tikzname\ edge nodes that needs to be passed -- back to the \TeX layer unmodified. -- @param options The options of the new edge. -- @param tikz_options A table of \tikzname\ options to be used by graph drawing @@ -315,9 +315,9 @@ end -- function Graph:createEdge(first_node, second_node, direction, edge_nodes, options, tikz_options) local edge = Edge.new{ - direction = direction, + direction = direction, edge_nodes = edge_nodes, - options = options, + options = options, tikz_options = tikz_options } edge:addNode(first_node) @@ -393,4 +393,4 @@ end -- Done -return Graph
\ No newline at end of file +return Graph diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Iterators.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Iterators.lua index 9e41e1124ee..903291a892d 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Iterators.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Iterators.lua @@ -39,40 +39,40 @@ local lib = require("pgf.gd.lib") -- @return An iterator for traversing \meta{graph} in a topological order. -- function Iterators.topologicallySorted(dag) - -- track visited edges + -- track visited edges local deleted_edges = {} -- collect all sources (nodes with no incoming edges) of the dag local sources = lib.imap(dag.nodes, function (node) if node:getInDegree() == 0 then return node end end) -- return the iterator function - return function () + return function () while #sources > 0 do -- fetch the next sink from the queue local source = table.remove(sources, 1) -- get its outgoing edges local out_edges = source:getOutgoingEdges() - + -- iterate over all outgoing edges we haven't visited yet for _,edge in ipairs(out_edges) do - if not deleted_edges[edge] then - -- mark the edge as visited - deleted_edges[edge] = true - - -- get the node at the other end of the edge - local neighbour = edge:getNeighbour(source) - - -- get a list of all incoming edges of the neighbour that have - -- not been visited yet - local in_edges = lib.imap(neighbour:getIncomingEdges(), - function (edge) if not deleted_edges[edge] then return edge end end) - - -- if there are no such edges then we have a new source - if #in_edges == 0 then - sources[#sources+1] = neighbour - end - end + if not deleted_edges[edge] then + -- mark the edge as visited + deleted_edges[edge] = true + + -- get the node at the other end of the edge + local neighbour = edge:getNeighbour(source) + + -- get a list of all incoming edges of the neighbor that have + -- not been visited yet + local in_edges = lib.imap(neighbour:getIncomingEdges(), + function (edge) if not deleted_edges[edge] then return edge end end) + + -- if there are no such edges then we have a new source + if #in_edges == 0 then + sources[#sources+1] = neighbour + end + end end -- return the current source @@ -88,4 +88,4 @@ end -- Done -return Iterators
\ No newline at end of file +return Iterators diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Node.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Node.lua index 84d3d3ee11f..379a65fafd8 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Node.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Node.lua @@ -48,12 +48,12 @@ function Node.new(values) local new = { class = Node, name = nil, - tex = { + tex = { -- texNode = nil, -- maxX = nil, -- minX = nil, -- maxY = nil, - -- minY = nil + -- minY = nil }, edges = {}, -- pos = nil, @@ -69,8 +69,8 @@ function Node.new(values) new [k] = v end end - if not new.pos then - new.pos = Vector.new(2) + if not new.pos then + new.pos = Vector.new(2) end return new end @@ -91,8 +91,8 @@ end --- Returns the value of the node option \meta{name}. -- -- @param name Name of the node option. --- @param graph If this optional argument is given, --- in case the option is not set as a node parameter, +-- @param graph If this optional argument is given, +-- in case the option is not set as a node parameter, -- we try to look it up as a graph parameter. -- -- @return The value of the node option \meta{name} or |nil|. @@ -113,7 +113,7 @@ end ---- Computes the heigth of the node. +--- Computes the height of the node. -- -- @return Height of the node. -- @@ -155,7 +155,7 @@ end --- Returns all edges of the node. -- --- Instead of calling |node:getEdges()| the edges can alternatively be +-- Instead of calling |node:getEdges()| the edges can alternatively be -- accessed directly with |node.edges|. -- -- @return All edges of the node. @@ -168,7 +168,7 @@ end --- Returns the incoming edges of the node. Undefined result for hyperedges. -- --- @param ignore_reversed Optional parameter to consider reversed edges not +-- @param ignore_reversed Optional parameter to consider reversed edges not -- reversed for this method call. Defaults to |false|. -- -- @return Incoming edges of the node. This includes undirected edges @@ -176,16 +176,16 @@ end -- function Node:getIncomingEdges(ignore_reversed) return lib.imap(self.edges, - function (edge) - if edge:isHead(self, ignore_reversed) then return edge end - end) + function (edge) + if edge:isHead(self, ignore_reversed) then return edge end + end) end --- Returns the outgoing edges of the node. Undefined result for hyperedges. -- --- @param ignore_reversed Optional parameter to consider reversed edges not +-- @param ignore_reversed Optional parameter to consider reversed edges not -- reversed for this method call. Defaults to |false|. -- -- @return Outgoing edges of the node. This includes undirected edges @@ -193,9 +193,9 @@ end -- function Node:getOutgoingEdges(ignore_reversed) return lib.imap(self.edges, - function (edge) - if edge:isTail(self, ignore_reversed) then return edge end - end) + function (edge) + if edge:isTail(self, ignore_reversed) then return edge end + end) end @@ -204,7 +204,7 @@ end -- -- @see Node:getIncomingEdges(reversed) -- --- @param ignore_reversed Optional parameter to consider reversed edges not +-- @param ignore_reversed Optional parameter to consider reversed edges not -- reversed for this method call. Defaults to |false|. -- -- @return The number of incoming edges of the node. @@ -219,7 +219,7 @@ end -- -- @see Node:getOutgoingEdges() -- --- @param ignore_reversed Optional parameter to consider reversed edges not +-- @param ignore_reversed Optional parameter to consider reversed edges not -- reversed for this method call. Defaults to |false|. -- -- @return The number of outgoing edges of the node. @@ -230,7 +230,7 @@ end ---- Creates a shallow copy of the node. +--- Creates a shallow copy of the node. -- -- Most notably, the edges adjacent are not preserved in the copy. -- @@ -262,7 +262,7 @@ end -- -- @ignore This should not appear in the documentation. -- --- @return String represenation of the node. +-- @return String representation of the node. -- function Node:__tostring() local tmp = Node.__tostring @@ -277,4 +277,4 @@ end -- Done -return Node
\ No newline at end of file +return Node diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Vector.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Vector.lua index ef8500b5aeb..8af7378154e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Vector.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Vector.lua @@ -28,7 +28,7 @@ lib.Vector = Vector -- Class setup Vector.__index = function (t, k) - if k == "x" then + if k == "x" then return rawget(t,1) elseif k == "y" then return rawget(t,2) @@ -37,8 +37,8 @@ Vector.__index = end end Vector.__newindex = - function (t, k, v) - if k == "x" then + function (t, k, v) + if k == "x" then rawset(t,1,v) elseif k == "y" then rawset(t,2,v) @@ -52,9 +52,9 @@ Vector.__newindex = --- Creates a new vector with \meta{n} values using an optional \meta{fill\_function}. -- -- @param n The number of elements of the vector. (If omitted, then 2.) --- @param fill_function Optional function that takes a number between 1 and \meta{n} +-- @param fill_function Optional function that takes a number between 1 and \meta{n} -- and is expected to return a value for the corresponding element --- of the vector. If omitted, all elements of the vector will +-- of the vector. If omitted, all elements of the vector will -- be initialized with 0. -- -- @return A newly-allocated vector with \meta{n} elements. @@ -65,7 +65,7 @@ function Vector.new(n, fill_function) setmetatable(vector, Vector) local n = n or 2 - + if type(n) == 'table' then for k,v in pairs(n) do vector[k] = v @@ -74,7 +74,7 @@ function Vector.new(n, fill_function) -- fill vector elements with values if not fill_function then for i = 1,n do - rawset(vector,i,0) + rawset(vector,i,0) end else for i = 1,n do @@ -91,7 +91,7 @@ end --- Creates a copy of the vector that holds the same elements as the original. -- -- @return A newly-allocated copy of the vector holding exactly the same elements. --- +-- function Vector:copy() return Vector.new(#self, function (n) return self[n] end) end @@ -100,7 +100,7 @@ end --- Performs a vector addition and returns the result in a new vector. -- --- @param other The vector to add. +-- @param other The vector to add. -- -- @return A new vector with the result of the addition. -- @@ -114,7 +114,7 @@ end --- Subtracts two vectors and returns the result in a new vector. -- --- @param other Vector to subtract. +-- @param other Vector to subtract. -- -- @return A new vector with the result of the subtraction. -- @@ -196,7 +196,7 @@ end --- Updates the values of the vector in-place. -- -- @param update_function A function that is called for each element of the --- vector. The elements are replaced by the values +-- vector. The elements are replaced by the values -- returned from this function. -- function Vector:update(update_function) @@ -253,4 +253,4 @@ end -- Done -return Vector
\ No newline at end of file +return Vector |