1 Introduction
1.1 Definitions
Throughout this paper is a simple (i.e., a finite, connected, undirected, loopless and without multiple edges) graph with vertex set of cardinality and edge set of cardinality .
A set is independent if no two vertices in are adjacent. An independent set of maximum cardinality, named a maximum independent set, and its size is called the independence number and denoted . An independence polynomial of graph defined by Gutman and Harary in 1983 [1]:
(1) 
where denotes the number of independent sets of cardinality in the graph . is the number of independent sets with minimal cardinality in (i.e empty set) [6].
A tree decomposition of a general graph is a tree of ”bags”, where if edge then and are together in same ”bag”, and the “bags” containing are connected in . The width of a tree decomposition equal to one less than the maximum bag size and the treewidth of equal to least width of all tree decompositions for .
1.2 Computing the independence polynomial
To compute the independence polynomials , as shown in Levit and Mandrescu survey [2] one can use the following recursive formula:
(2) 
where N[v] is the neighborhood of the vertex v including v itself.
1.3 Problem
Some facts on similar problems:

Computing the Maximum Independent Set of a general graph is an NPComplete problem.

Computing the Independence Polynomial of a general graph is also an NPComplete problem. The degree of the independence polynomial is equivalent to the Maximum Independent Set.

There are families of graphs with a closedform expression for their independence polynomial [8], but from what is known, trees are not one of them.

Some families of graphs have a polynomial algorithm to compute their . Does it give us hope for a polynomial algorithm to compute their independence polynomials?
According to Bodlaender [4], many practical problems rely heavily on graphs with bounded treewidth.
Tittmann [5] offers a way for the construction of an algorithm that computes the independence polynomial of a graph with bounded treewidth in polynomial time based on a specific partition.
Based on Tittmann, who described in acronyms how an algorithm for graphs with a bounded treewidth should look, we accurately investigated an actual algorithm for trees.
Yosef, Mizrachi, and K. developed an efficient approach for computing the independence polynomials of trees with vertices [3]. This approach is based on an extensive database containing the independence polynomials of all the trees with up to vertices, and the induction step computing the independence polynomials of all the trees with vertices based on their counterparts. Although this approach works well with smallsized trees, big trees may require an enormous database to compute their independence polynomials.
2 Main idea of algorithm
The new algorithm is not based on a database nor requires one. Instead, it used the dynamic programming
technique.
The independence polynomial represented in the algorithm as a list with cells in the following format:
Graph  Stored as  

From the computing process, the independence polynomial formula, as described in (2), says that every vertex can be calculated just after its children and grandchildren are calculated. Postordertraversal validates that the children and grandchildren vertices will be computed before the father vertex.
To examine all tree graphs, we divided them into three cases:

:

because has no vertices in , there is one independent set of cardinality zero (i.e., empty set).

from the same reason above. so:


:

because when vertex removed, the graph stay with only one vertex, and this subgraph matches the previous case.

because has no vertices in , there is one independent set of cardinality zero (i.e., empty set). so:


:

Start with traveling on the tree in postorder traversal. When reaching a leaf node, like case 1, it can calculate by A:


For an inner vertex that all its children were calculated, when vertex v is removed, the number of connected components can rise, and in such case, computation of subgraphs union, as described in (3), is needed.
So in purpose to calculate , compute next parameters:


parameter said that we remove the vertex v with its neighbors so we can use parameter of the children:


Finally use formula 2 to calculate .
3 Main Algorithm
The algorithm in FIP (find independence polynomial) function starts at selected root node of a tree and goes as far as it can down a given branch in FIPR (find independence polynomial recursion) function, then backtracks until it finds an unexplored path, and then explores it. The algorithm does this until the entire graph has been explored.
4 Proof of correctness
Lemma 4.1.
FIPR(T, root) is called exactly once for each vertex in the graph
Proof.
Clearly FIPR(T, root) is called for a vertex u only if it not discovered. The moment it’s called, FIPR(T, root) cannot be called vertex v again. Furthermore, because T is connected component, and FIPR(T, root) uses post order travesal in the implementation, it’s ensures that it will be called for every vertex in T. ∎
Lemma 4.2.
The body of the foreach loop that explore undiscovered vertices that are rootneighbors (lines 68) is executed exactly once for each edge (v,u) in the graph.
Proof.
FIPR(T, root) is called exactly once for each vertex root (Claim 1). And the body of the loop is executed once for all the unseen edges that connect to root. ∎
Corollary 4.1.
The algorithm can start from every vertex root such that
and get the same runtime.
Proof.
The order of walking on the tree is in post order travels. In this way, it go through each edge exactly twice so that is no matter which vertex v it start from, the running time will remain the same. ∎
Therefore, the running time of the FIPR(T, root) algorithm is , and the tested graphs are trees, so it summarise to .
5 Conclusion
In this article we have presented a linear algorithm that uses dynamic programming to find an independence polynomial of trees. The algorithm uses a postordertravel over the graph. when it reaches the leaves it calculates them, and in the backtracking, when all children were calculated, there comes the father turn to compute.
References
 [1] Gutman I. and Harary F., Generalizations of the matching polynomial, Utilitas Mathematica, Vol. 24, 97106, 1983.
 [2] Levit V. E. and Mandrescu E., The independence polynomial of a graph  a survey Proceedings of the 1st International Conference on Algebraic Informatics, 231252, 2005.
 [3] Yosef R., Mizrachi M., Kadrawi O. On unimodality of independence polynomials of trees, https://arxiv.org/pdf/2101.06744v3.pdf, 2021.

[4]
Hans L. B., A linear time algorithm for finding treedecompositions of small treewidth, SIAM,
https://epubs.siam.org/doi/pdf/10.1137/S0097539793251219, 1996.  [5] Tittmann P. Graph polynomials: The Ethernal Book, 2021.
 [6] Levit V. E. and Mandrescu E., On Unimodality of Independence Polynomials of some WellCovered Trees, Discrete Mathematics and Theoretical Computer Science, Vol. 4, 237256, 2003.
 [7] Hoede C. and Li X., Clique polynomials and independent set polynomials of graphs, Discrete Mathematics, Vol. 125, 219228, 1994.

[8]
Ferrin G. M., Independence polynomials ,University of South Carolina, Master’s thesis, 2014.
https://scholarcommons.sc.edu/cgi/viewcontent.cgi?article=3632context=etd
Comments
There are no comments yet.