Abstract

The analysis of problem-solving tasks and construction of graphs have been leading to the development of new algorithms and software implementations. To verify the algorithm, it is necessary to make test data in such a way, that all values for the test are predetermined. The values for testing algorithms via graphs are: the number of vertices in the graph; the vertex degree; connectivity of the graph; permissibility of multiple edges and loops; the weight of the graph edges. If the values are known for the test graph then we can calculate the expected results of the designed algorithm and match them with the actual ones in a well-posed manner. The algorithm and some elements of software implementation of generating nite undirected graphs, with such values as the number of vertices n and the degree of the vertices k = const, which correspond to correctness of additional conditional statements, are presented in the article. The general scheme of the algorithm is as follows. Create two lists of vertices L1 and L2. The list L1 is initially empty; in the list L2 we have all vertices of the graph from 1 to n. We take the rst vertex in L2, we build all k edges to it and transfer it to the list L1. Repeat the same for each next vertex of the L2 list, except the last one. The last vertex L2 is just transferred to L1. The algorithm immediately builds the adjacency matrix by modeling list operations with L1 and L2. According to the algorithm, the adjacency matrix will always be the same for xed n and k when the algorithm is repeated. To obtain dierent matrices, the rule of graph isomorphism is used: perform the permutations of the rows and columns of the resulting matrix.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call