<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>ORCID:</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>A Random Flat Graph Drawing Generation Algorithm for Testing Printed Circuit Board Tracing Software</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Sergey Sgadov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Zaporizhzhia National University</institution>
          ,
          <addr-line>Address, Zhukovskogo st. 66, 69600</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
      </contrib-group>
      <volume>000</volume>
      <fpage>0</fpage>
      <lpage>0002</lpage>
      <abstract>
        <p>Printed board circuits tracing program design need in testing steps. In case of preplanarization stage it is need to use planar graph data for test set. This paper presents a simple algorithm for generating a family of random planar graphs based on a triangulated graph that can be used in algorithms on graphs. The algorithm is based on the principle of removing random edges and generate both an adjacency matrix and a flat graph drawing. Generated graphs are connected undirected graphs without loops and multiple edges, without bridges and articulation points, without vertices with a local degree less than or equal to two. Results of performance measurement experiments are given. Random flat graph, graph drawing, algorithm on graph, graph generation, planarization There are two trends in methods of printed board circuits (PCB) programs tracing algorithms design - they are a geometrical approach (for example, wave methods of Lee) and using of the topological of connections graph of constructs [1]-[3]. In the algorithms, implementing topological approach great attention is paid to operations on flat sugrafs [4]-[6]. For example at the work [5] the flat part of the graph is built with extraction algorithm of subset of isometric cycles with a capacity equal to the cyclomatic number of the graph, characterizing with minimum value of the MacLane's functional, followed by removing the minimum number of edges. This allows us to consider the implementation of intersecting connections on PCB as the construction of a new topological drawing with added vertices. Its need for implementation of such algorithms testing on a set of adequate input data of a big size. Such data set often descripts a planar graph. Therefore, it is extremely desirable to have embedding in straight lines on the plane of this graph for preliminary estimate of its properties and comparison with results of testing of tracing algorithms. It is obvious that at small number of vertices of N, the solution of the task is trivial, but at big N and automatic generation of nondirectional flat graphs is desirable to have an algorithm or the program for a solution of such task. where the Markov chain has been defined on a great number of planar graphs G  algorithm is very simple and, apparently, well works at practice. However, it iterates only to uniform distribution so any algorithm execution will surely lead to obtaining heterogeneous results. It is ICTERI-2021, Vol I: Main Conference, PhD Symposium, Posters and Demonstrations, September 28 - October 2, 2021, Kherson, Ukraine</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>2. Related Works</title>
      <p>
        Denise, Vaskonsellos and Welsh [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] proposed the first algorithm of random generation of flat graphs
aggravated with the fact that the speed of convergence is unknown. Bodirski, Gr. Opl and Kang [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]
developed the second approach on G
      </p>
      <p>
        for homogeneous accidental generation. It is based on the
recursive method proposed by Nijenhuis and Wilf [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] and formalized by Flajolet, Van Cutsem and
Zimmermann [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. This method involves a precalculation stage where big tables with big coefficients
      </p>
      <p>
        2021 Copyright for this paper by its authors.
that calculated with use of recursive ratios. Bodirsky and others apply a recursive method on flat graphs
that allows well-known combinatory decomposition according to consecutive levels of connectivity.
Time necessary for a precalculation stage is big. More precisely, for random generation of flat graphs
with vertices (and, perhaps, also with the fixed number of edges), has requirements for time and memory
at a precalculation stage up to O (n7 (log  )2 (log log n)) and O (n5log n). After tables have been
calculated, time for each generation is O (n3). In [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] the algorithm by computing complexity of O (n7)
and the requirement for memory is O (n4) for the uniform flat graph is proposed. Unfortunately, any
of the listed methods does not guarantee inseparability of the graph and also does not build its
embedding on to Euclidean plane. Thus, if one want to visualize the graph, they have to use special
embedding algorithm realization.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. The Problem Statement</title>
      <p>Despite the large number of publications on the topic of random structures, the author was unable
to find among them a method that would simultaneously give a drawing and an adjacency matrix of a
plane graph consisting of cycles and satisfying additional conditions. Therefore, one have a problem
and it is necessary to generate random single-connected planar graph from N-vertices and
simultaneously geometrical drawing of the graph embedded onto the plane (so-called, flat graph). Also
it is applied additional requirements - the graph must be nonseparable, that is to represent coherent
nondirectional acyclic graph and without multiple edges, without bridges and articulation points,
without vertices with local valence of vertices smaller or equal to two. Therefore, it to be aimed to
receive the graph in the form of the list of adjacency and the geometrical drawing of the graph at the
same time, without using special algorithms on planar graphs embedding . This article considers of a
solution of a problem of generation of random flat graphs embedding in the Delphi language.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Proposed Algorithm for Flat Graph Generation</title>
      <p>Let us declare a vertex as integer number, then an edge will be describes as two incident vertices
(V1, V2). The list Edges of edges can describes the graph. In addition, 2D structure G (adjacency list)
describes the graph as a list of vertices that are incident to given is declared. This is a two-dimensional
structure that represents a list of lists of variable length. The Delphi XE10.4 syntax allows you to
implant properties and methods that provide an interface to the structure's fields in such a way that it
can be accessed like a two-dimensional array. Also one needs to represent the vertex as a geometric
point with coordinates ( ,  ). The list Point is a list of such geometrical representation of graph's
vertices.</p>
      <p>Here the algorithm of procedure that proposed for random nonseparable flat graph generation
(Figure 1).</p>
      <p>In the algorithm the following identifiers are used:
NVert is quantity of tops in the graph,
Width, Height plot area sizes,
k - the number of attempts of edges removing as a part from their total quantity.</p>
      <p>Result of the algorithm work is the random planar graph presented as the list of adjacency G and
Points - coordinate of vertices of graphs embedding onto a plane in straight lines.</p>
      <p>Let us consider steps of this algorithm.</p>
      <p>Step 1.</p>
      <p>Let us set coordinates of borders of two-dimensional rectangular area. Then generate N random
uniform distributed points. After this, let us sort the list of points on one of coordinates (Figure 2)</p>
      <p>Step 2.</p>
      <p>If possible, connect as many N-points as possible with non-intersecting straight lines. For small N,
this can be done graphically. but for N more than 20, it makes sense to use special algorithms, for
example, Delaney triangulation algorithms. After triangulation is applied, the 2D region will be
triangulated. At this stage, a graph is obtained consisting of the same size of triangular faces and it is
possible to compose an adjacency matrix of such a graph, because we know how the points are
connected (Figure 3).</p>
      <p>Step 3.</p>
      <p>Random removal of edges. (Figure 4) Despite the fact that at the previous step we have already
obtained a certain random flat graph, it is clearly not enough to solve the problem. Therefore, at this
stage, one should try to sequentially remove some predetermined number of random edges. However,
if this is done without preliminary verification, then as a result we may find that the resulting graph has
obtained properties we do not need, for example, it has not be simply connected, or dangling vertices
have appeared. Therefore, before removing an edge, it is necessary to check:
1. is the edge a bridge;
2. is the edge an articulation point;
3. what is the valence of the vertices of the edge (if it is too small, then removing such an edge at
best can turn the graph into a tree, and at worst - cause the appearance of dangling vertices).</p>
      <p>For triangulation, we used the scanline algorithm, which assumes that all points have been sorted by
one of the coordinates before, and then, in their order, are processed by the next way:
• Construct a triangle on the first 3 points. Further, for each next point, we will perform the steps
based on the fact that there is a Delaunay triangulation for the already added points and, accordingly,
a minimal convex hull for them.
• Add triangles formed by visible edges and the point itself (that is, add edges from the point in
question to all ends of the visible edges).
• Check for the Delaunay condition all quadrangles generated by visible edges. If the condition
is not met somewhere, then we rebuild the triangulation in the quadrangle (recall that there are only
two of them) and recursively run the check for quadrangles generated by the edges of the current
quadrilateral (because only in them, after changing, the Delaunay condition could be violated).</p>
      <p>
        There is an assumption that the computational complexity of the algorithm is approximately
O(N ∗ log N). It's not worse than O(N2) in other triangulation methods [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ],[
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] and does not
significantly affect the main algorithm with computational complexity not less than O(N2). Below
there are experimental data that show a quasi-linear dependence of the execution time on N.
4.2.
      </p>
    </sec>
    <sec id="sec-5">
      <title>Checking before edges removing</title>
      <p>It is necessary to check whether the removal of an edge will lead to a violation of the graph
connectivity. This will not happen if it is possible to find a path to one of the vertices that does not
contain the given edge. If, as a result of a depth-first search from a vertex of an edge, we can return
only through another vertex, then such an edge cannot be deleted. To do this, virtually remove the edge
and perform a depth-first search from all vertices that have not yet been in the spanning tree
construction. If in this case there is a return to the vertices incident to the removed edge, then return
TRUE - the edge can be removed. In case of violation of the graph connectivity, areas are formed that
do not belong to the spanning tree, which will be detected. For these purposes, we will create a function
(Figure 5)
function bridges_delete_edge(vertexfrom,
vertexto: TVertex;</p>
      <p>var G :TAdjMatrix ):Boolean,
where vertexfrom, vertexto are the vertices of the tested edge, Gis the adjacency matrix. The
function should return true if an edge (vertexfrom, vertexto) can be removed without breaking the
connectivity.
vertexfrom,
vertexto: TVertex;
var g :TAdjMatrix ):boolean;
which, using depth-first search, will check whether the removal of vertexfrom, vertextovertices
will lead to the formation of another connected area. Separately, it is necessary to check the local
valences of the vertices of the edge in case the edge is included in the chain (then the valencies will be
2 or less). Such edges also should not be removed. In general, at the moment before deleting an edge,
you can insert any check whether the graph will have the required properties or not.</p>
    </sec>
    <sec id="sec-6">
      <title>5. Experimental Verification of the Proposed Algorithm and Behcmarking.</title>
      <p>Algorithm was implemented with Delphi XE10.4 using VCL libraries because of using VCL based
classes for graph drawing. Also one had to take account Delphi written extensions for Altium CAD.</p>
      <p>k =
Hardware configuration of the system:
• CPU Ryzen 5 1600 (6 physical core, 12 threads) 3700MHz
• Chipset AMD X370
• Memory 8GB DDR4 DRAM 2666MHz
• SSD – Samsung 860 EVO 500GB SATA III
The Win API QueryPerformanceCounter calls were injected into the code of the
GeneratePlanarTriangGraph procedure, and the triangulation time and the vertex removal time were
measured separately for a different number of vertices N and the deletion part (Table 1, Table 2)
[the number of removal attempts] (1)</p>
      <p>Nedges
(where Nedges is the number of edges in triangulation). Due to the fact that the main algorithm
has an implicit dependence on the list of edges, it was executed in one thread.
,
In addition, the dependence of the execution time (sec) on N (Figure 6) was built.</p>
      <p>The results of the program are shown at Figure 7-9. The adjacency matrix is not given here for
obvious reasons.</p>
      <p>If one change the number of deletion attempts to ten times the number of edges in triangulation, then
an increase in the size of the faces becomes noticeable (Figure 10-12).
if the graph is checked for connectivity, it will not allow parallelizing the main algorithm. Therefore,
the program was launched in single-threaded mode. Although the elimination of this check immediately
reduces the computational complexity by a factor of N, due to the softening of the requirements for the
result, it allows parallelization.</p>
    </sec>
    <sec id="sec-7">
      <title>6. Conclusion</title>
      <p>The scientific novelty of work is that the random flat graph drawing generation algorithm have been
proposed that differs its computing complexity of O(N2) also allows to generate at the same time graph
embedding drawing. As show experiments computing complexity of an algorithm approximately
quadratic, generally because of checks on connectivity. If one not to be aimed a task to save the
connectivity of the graph, then the computing complexity will be quazilinear or linear. Also in this case
parallelization of an algorithm will be possible.</p>
      <p>The practical value of work is that the software in the Delphi language is worked out that implements
the offered algorithm and allows to receive random flat the graph and a matrix (list) of its adjacency.
We recommend it for generating test data sets for preplanarisation algorithm implementation. It gives
verifiability of programs the implementing algorithms on planar graphs and also to control visually
quality and properties of input data for testing as in addition to a connectivity matrix the program gives
embedding of the graph onto a plane.</p>
      <p>.</p>
    </sec>
    <sec id="sec-8">
      <title>7. References</title>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Den'dobren'ko</surname>
            ,
            <given-names>B. N.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Malika</surname>
            ,
            <given-names>A. S.</given-names>
          </string-name>
          , Automation of Electronic Radio Equipment Design, Vysshaya shkola, Moscow, Russia, (
          <year>1980</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Bazilevich</surname>
            ,
            <given-names>R. P.</given-names>
          </string-name>
          <article-title>and etc., The Custom VLSI Layout Minimization on the Digital Circuits Topological Design, Control systems</article-title>
          and computers, Kyiv, Ukraine, vol
          <volume>11</volume>
          , pp.
          <fpage>42</fpage>
          -
          <lpage>50</lpage>
          (
          <year>2012</year>
          ) URL: http://dspace.nbuv.gov.ua/handle/123456789/83082.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Kureichik</surname>
            ,
            <given-names>V. V.</given-names>
          </string-name>
          ,
          <article-title>Matematicheskoe obespechenie konstruktorskogo i tekhnologicheskogo proektirovaniya s primeneniem SAPR, Radio i Svyaz'</article-title>
          , Moscow, Russia, (
          <year>1990</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Kurapov</surname>
            ,
            <given-names>S. V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Davidovsky</surname>
            ,
            <given-names>M. V.</given-names>
          </string-name>
          ,
          <article-title>Topological approach to connections conducting in flat formfactor</article-title>
          .
          <source>Komponenty i Tekhnologii</source>
          ,
          <volume>11</volume>
          (
          <issue>172</issue>
          ) pp.
          <fpage>127</fpage>
          -
          <lpage>130</lpage>
          , (
          <year>2015</year>
          ) URL: https://www.elibrary.ru/contents.asp?id=34181322&amp;selid=
          <fpage>24863778</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5] . Kurapov,
          <string-name>
            <given-names>S. V</given-names>
            ,
            <surname>Davidovsky</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.V.</surname>
          </string-name>
          ,
          <article-title>Algorithms for constructing topological and geometric drawings of the SES graph // Components</article-title>
          and Technologies. 6 , pp.
          <fpage>128</fpage>
          -
          <lpage>132</lpage>
          , (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Kurapov</surname>
            <given-names>S.V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Davidovsky</surname>
            <given-names>M.V.</given-names>
          </string-name>
          ,
          <article-title>Checking the planarity and building a topological drawing of a plane graph (depth-first search), Prikl</article-title>
          . MD,
          <volume>2</volume>
          (
          <issue>32</issue>
          ), pp.
          <fpage>100</fpage>
          -
          <lpage>114</lpage>
          , (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Denise</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vasconcellos</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>and.</given-names>
            <surname>Welsh</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.J.</surname>
          </string-name>
          <article-title>The random planar graph</article-title>
          .
          <source>Congressus Numerantium</source>
          ,
          <volume>113</volume>
          pp.
          <fpage>61</fpage>
          -
          <lpage>79</lpage>
          (
          <year>1996</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Bodirskya</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gröpl</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kang</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <article-title>Generating labeled planar graphs uniformly at random</article-title>
          ,
          <source>Theoretical Computer Science</source>
          <volume>379</volume>
          (
          <issue>3</issue>
          ), pp.
          <fpage>377</fpage>
          -
          <lpage>386</lpage>
          , (
          <year>2007</year>
          ). doi:
          <volume>10</volume>
          .1016/J.TCS.
          <year>2007</year>
          .
          <volume>02</volume>
          .045.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Nijenhuis</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wilf</surname>
            ,
            <given-names>H.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Combinatorial</surname>
            <given-names>algorithms</given-names>
          </string-name>
          , 2rd. ed. Academic Press Inc., New York, San Francisco, London (
          <year>1978</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Flajolet</surname>
            ,
            <given-names>Ph.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zimmerman</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cutsem</surname>
            ,
            <given-names>B. V.</given-names>
          </string-name>
          ,
          <article-title>A calculus for the random generationof labelled combinatorial structures</article-title>
          .
          <source>Theoretical Computer Science</source>
          , volume
          <volume>132</volume>
          (
          <issue>1-2</issue>
          ), pp.
          <fpage>1</fpage>
          -
          <lpage>35</lpage>
          , (
          <year>1994</year>
          ) .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Teplov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Maykov</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <article-title>Comparative analysis and modification of algorithms for constructing delone triangulation In: Modern Technologies in Science and Education -</article-title>
          <source>STNO-2017</source>
          Volume 4 pp.
          <fpage>103</fpage>
          -
          <lpage>106</lpage>
          , (
          <year>2017</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Klyachin</surname>
            <given-names>V.</given-names>
          </string-name>
          ,
          <source>Triangulation Algorithm Based on Empty Convex Set Condition</source>
          ,
          <source>Science Journal of Volgograd State University. Mathematics. Physics 3</source>
          , vol.
          <volume>28</volume>
          , pp.
          <fpage>27</fpage>
          -
          <lpage>33</lpage>
          , (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>