tinygarden - A java package for testing properties of spanning trees

Spanning trees are fundamental objects in graph theory. The spanning tree set size of an arbitrary graph can be very large. This limitation discourages its analysis. However interesting patterns can emerge in small cases. In this article we introduce tinygarden , a java package for validating hypothesis, testing properties and discovering patterns from the spanning tree set of an arbitrary graph


Introduction
Graph theory is a longstanding and well-established area of discrete mathematics.Graphs are abstract models of pairwise relations between entities in some domain.A graph G = (V, E) is composed of V -a set of vertices (or nodes)-and E -a set of edges-.Each node is a point representing an entity and each edge is a line connecting two nodes.For example we can model friendship relationships in a social network by associating a node to each person and connecting two nodes with an edge if the corresponding people are friends.
Let G = (V, E) be the following graph and such that V ′ contains all endpoints of the edges in E ′ .A path p = (e 1 , . . ., e k ) is a sequence of consecutive edges of G.We say that G is connected if there is at least one path between each pair of nodes.A tree is a connected graph without cycles.And finally, a spanning tree T ⊆ G is a tree that contains all the nodes of G. Spanning trees are important in optimization [1], network design [2], VLSI interconnection [3], clustering [4], complexity theory [5], graph invariants [6], fundamental cycle bases [7] and in many more areas of applied and theoretical sciences.
The spanning tree set of an arbitrary graph can be very large [8].This limit prevents the entire set from being explored.However, there are algorithms to generate all spanning trees of a graph ( [9], [10], [11]) that are suitable in the case of small instances.

Software description
The tinygarden package is a self-contained group of java classes that enables the exploration of the set of spanning trees of a given graph.It implements Matsui algorithm [11] to generate it.
The architecture is simple.The class SpanningTreesMatsui organizes the whole process.Custom descendants of two class hierarchies: Collectors and Processors are invoked sequentially to process each spanning tree.Collectors are useful for global analysis of the entire set, for example, count the number of spanning trees with a certain property.Processors, on the other hand, are useful for local tasks, such as generating a pretty-print version of a specific spanning tree.
The package also implements helper classes, such as Graph, SparseMatrix, UnionFind, etc.Since a Graph can be built based on a text file containing its incidence matrix, it works well together with nauty [12], the well-known graph software.

Limitations and improvements
The scope of the tinygarden package is restricted to specific graph theory problems.The most important limitation is the size of the instances that can be processed; it was conceived to explore the spanning tree set of all non-isomorphic graphs of at most 9 nodes.Consequently, two important improvements would be: • A distributed implementation of Matsui algorithm: in order to process larger graphs.
• Compute the spanning tree set size [13]: to process graphs with smaller size compared to a prescribed threshold.
The first version of the package was recently made public.At the moment is only being used by the authors.

Impact
The tinygarden package is a tool for validating hypothesis, testing properties, and discovering patterns from the spanning tree set of an arbitrary graph.To the best of our knowledge this is the only tool with these features.
In [14] we introduced the mstci problem, the tinygarden package proved to be effective in finding a pattern related to the intersection number of complete graphs which led to its main result, and to set a solid basis for the conjecture posed in it.It was an important tool to evaluate a metaheuristic algorithm for graph integration [15].We are currently using it to test an algorithm in order to find a good solution to the mstci problem.
The package can be used to analyze general questions, i.e.: list the spanning trees with minimum diameter of a graph, as well as to carry out statistical analysis, i.e.: calculate the distribution of the graphs of a fixed number of nodes with respect to the spanning tree with shortest total path length [5].
Based on our package, several NP-hard problems can be analyzed from a statistical perspective, for example Fig. 5 shows the distribution of the Minimum Fundamental Cycle Basis (or Min FCB ) [16] of 8 node graphs.This information can be used to implement approximate or heuristic algorithms in order to find good solutions for these problems.

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Figure 1 :
Figure 1: Example of a Graph

Figure 2 :
Figure 2: Example of a Path

Figure 3 :
Figure 3: Example of a Cycle

Figure 4 :
Figure 4: Example of a Spanning Tree

Figure 5 :
Figure 5: Distribution of the Min FCB of the graphs of 8 nodes (left).Aggregated relation of the Min FCB with respect to the number of edges (right)