Counting All Possible Simple Paths using Artificial ...

3 downloads 631 Views 976KB Size Report
Mar 13, 2015 - Cell Division Mechanism for Directed Acyclic. Graphs. Sankhadeep Chatterjee. B.Tech Student. Hooghly Engineering & Technology College,.
Proceedings of the 9th INDIACom; INDIACom-2015; IEEE Conference ID: 35071 2015 2 International Conference on “Computing for Sustainable Global Development”, 11 th - 13th March, 2015 Bharati Vidyapeeth's Institute of Computer Applications and Management (BVICAM), New Delhi (INDIA) nd

Counting All Possible Simple Paths using Artificial Cell Division Mechanism for Directed Acyclic Graphs Sankhadeep Chatterjee

Sirshendu Hore

B.Tech Student Hooghly Engineering & Technology College, Hooghly, INDIA Email id: [email protected]

Assistant Professor, Dept of CSE, Hooghly Engineering & Technology College, Hooghly, INDIA Email id: [email protected]

Saubhik Paladhi

Nilanjan Dey

B.Tech Student Hooghly Engineering & Technology College, Hooghly, INDIA Email id: [email protected]

Dept. of ETCE, Jadavpur University, West Bengal,INDIA Email id: [email protected]

Abstract – Counting all possible paths between two nodes is always a challenging job. The work present a multi-agent counting model based upon the concept of biological cell division method. Artificial Cells, which are inspired by biological living cells works as the key feature in counting process, are governed by artificial rules and abilities. In the proposed work a novel algorithm is used to find the number of simple paths between two nodes of a directed acyclic graph. The algorithm is built upon the proposed model of multiple agents which works simultaneously instead of single agent to find the solution by discarding unsuccessful and repetitive traverses. A detail theoretical and experimental analysis is provided in evidence of ingenuity of the proposed algorithm. Keywords – Acyclic Graph; Agent; Artificial Cell; Cell Division; Counting; Directed Graph; Inheritance

I.

INTRODUCTION

Counting all possible paths between two nodes is a significant issue in computer network. The proposed algorithm tries to find the number of all possible paths between two nodes is based on cell division mechanism [1][2][3] in which two or more cell are produced by a parent cell when it is divided. Child cells inherit the ability of parent cell. Finding all possible paths between two nodes is computationally equivalent to NP-complete problems [4]. Lin et al. [5] have reported that the problem of counting maximal sets is similar in context of problem intractability. Creignou et al. [6] has proposed a generalised counting problem. The idea behind polynomial-time hierarchy which can be used successfully to classify the problems which do not have a polynomial-time algorithm but seems to have one has been established by Wrathall [7]. Kozen [8] has proposed an

efficient method to solve graph based counting problems. The analysis of intractability has been addressed in the literature. Markopoulou et al. [9] have established a novel quantum mechanical observable base mechanism for path counting. Provan et al. [10] shown that a probabilistic approach can be used to find whether two nodes in a graph are connected or not. A study to find binary strings apart from the given one, satisfied by a set of operations, has been reported by Bua et al. [11]. The study has revealed that an O(m2n) algorithm can be used to verify whether a string can be represented by another set of literals or not and it draws conclusion on satisfiability problems which deals with Boolean expressions. Okamoto et al. [12] proposed various algorithms to solve the different counting problems on independent sets in a chordal graph. The algorithms devised by Okamoto et al. have inspired the present work to a greater extent. A different probabilistic approach for finding the number of connected pairs has been reported in literature [13]. The variety of research work in the classical field of NP- completeness has drawn the interest of the authors to study the problem of counting all possible paths between two nodes in a graph. In the proposed work by analysing the algorithms and experimental results ingenuity of the model has been established. II. PROPOSED METHOD Artificial Cell. An Artificial Cell, is an abstract entity which is inspired by cells of living organisms, has limited and artificial abilities.

Copy Right © INDIACom-2015; ISSN 0973-7529; ISBN 978-93-80544-14-4

6.236

Counting All Possible Simple Paths using Artificial Cell Division Mechanism for Directed Acyclic Graphs

Artificial Cell Division. Artificial Cell Division is a process of reproduction of new Artificial Cells and is bounded by limited artificial rules. Artificial cell, which are by definition inspired by living cells, are considered to have artificial abilities which are as follows; 1. An Artificial Cell can produce multiple Artificial Cells. 2. An Artificial Cell produces new artificial cells if and only if it finds its necessity, otherwise not 3. An Artificial Cell has the intelligence to check whether a necessity has come or not.

1. Artificial Cells have an understanding of time and it is strictly discrete. 2. After each unit of time they check for their necessity. It may go for an Artificial Cell division or may evolve itself to a new Artificial Cell depending on the necessity. 3. Each new born cell is placed in different places in the system.

The Artificial Cell division also has certain limitation and bounded by artificial rules which are as follows; 1. Newly born cells inherit same abilities as their ancestor had. 2. Each descendant will be different from its ancestors and also distinguishable among themselves. Thus the first abilities and characteristics of the first Artificial Cell persist as long as their descendants survive. In the proposed work the application of Artificial Cell division is opted to solve the problem of counting all possible simple paths from a given source node to a destination node of a directed acyclic graph (DAG). The model of the Artificial Cell division processes is used in the system (which is basically a DAG) in such a way that it reflects a multi-agent counting process. Typically existing algorithms traverse the whole search space (the given DAG) to look for simple paths from the given source to destination one at a time. The proposed model is designed in such a way that it can process multiple possibilities in a single iteration. The task of enumerating all possibilities of directing the search to different directions at certain moment of the process is accomplished by the activities of different Artificial Cells present at that moment in the system. At any moment different Artificial Cells do their job (for instance checking necessity) independently. Thus a parallel working pattern which effectively helps in reducing the cost of solving the problem can be observed. Artificial rules along with artificial abilities also play a vital role in identifying different paths from the source to destination uniquely. If an Artificial Cell finds that its necessity to produce new generation of Artificial Cells, it immediately starts the process of cell division. As all its descendants inherit all its abilities, they will also show same type of behaviour. In this way the total number of Artificial Cells will gradually increase or may decrease (in some trivial cases).

Fig. 1

Fig. 1(a)

III. ARTIFICIAL CELL DIVISION AS A MULTIAGENT COUNTING TECHNIQUE To solve the problem of counting all possible simple paths between any given source and destination the Artificial Cell division is used with some little modification. The modifications are as follows; Copy Right © INDIACom-2015; ISSN 0973-7529; ISBN 978-93-80544-14-4

6.237

Proceedings of the 9th INDIACom; INDIACom-2015; IEEE Conference ID: 35071 2015 2 International Conference on “Computing for Sustainable Global Development”, 11 th - 13th March, 2015 nd

Fig. 1(b)

Fig. 1(e) Fig. 1, a typical example of a DAG having six nodes. It depicts how the model of Artificial Cell division can be used to find all possible simple paths between „1‟ and „6‟. Fig. 1(a) depicts the first Artificial Cell. After one unit of time it checks necessity and Artificial Cell division takes place thereby producing three different Artificial Cells. The naming convention of the cells is as follows; it takes the subscript of its ancestor and adds a new number over it to get a unique identification mark. Finally it results in the situation depicted in Fig.1(b). Fig. 1(c) depicts a typical case where the evolution of Artificial Cell C11 can be observed. Depending on the necessity condition it evolved to C111. Fig. 1(d) and 1(e) depict the final two steps until there is no further cell division or evolution is possible depending on the necessity condition.

Fig. 1(c)

The second and third assumptions are the most important conditions which must be satisfied by the Artificial Cells in order to solve the problem. The necessity condition is equally important in solving the problem. The concept behind necessity condition is as follows; the necessity condition takes different forms which result in different actions to be performed by an Artificial Cell. In the problem of counting all possible path between any two given node of a DAG has different forms of necessity conditions. The action of any Artificial Cell depends on the necessity condition at that moment. The necessity conditions for the problem are as follows; 1. If one cell encounters more than one path originating at any node at any moment, it will produce (through the process of Artificial Cell division) an equal number of cells and will place them in the nodes one by one on the nodes where the edges have terminated.

Fig. 1(d)

2. If one cell encounters only one path originating from the node of its current position, it will evolve itself to a new cell and will be placed at the node where the edge has terminated. 3. If the cell finds no originating path from its current position or it has reached the destination, it will stop producing or evolving to newer cells anymore. The above mentioned necessity conditions can be observed being applied by different Artificial Cells in the DAG depicted in Fig. 1. IV. THE PROPOSED ARTIFICIAL CELL DIVISION ALGORITHM Neighbour (Pc). It is defined as a set of edges (Pc, i) where Pc is the current position of Artificial Cell „c‟ at any moment in a DAG and i V, where V is the set of vertices of the DAG.

Copy Right © INDIACom-2015; ISSN 0973-7529; ISBN 978-93-80544-14-4

6.238

Counting All Possible Simple Paths using Artificial Cell Division Mechanism for Directed Acyclic Graphs

Algorithm Counting Path takes a DAG as input and stops when no further necessity condition can be satisfied by any of the Artificial Cells in the system. Algorithm: Counting Path (DAG) 1. Do for all Artificial Cells until necessity condition satisfied 2. If cell has not reached destination 3. Do for all vertices „v‟ such that (P c, v) Neighbour (Pc) 4. Produce new Artificial Cell or evolve depending on necessity condition The generation of Artificial Cells can be depicted using the Generation Tree which is a tree data structure depicting the generation of Artificial Cells, where every child node, depicts a new Artificial Cell, is either produced or evolved from the parent node which is an ancestor of it.

Artificial Cells (C11, C12 and C13). After 2nd generation of Artificial Cells it can be observed that all descendants of C11 and C12 are evolved including them. The 3rd necessity condition is a typical case where the generation of cells can‟t go further as no originating path exists from its current position. Lemma 2. Total number of simple paths is equal to the total number of leaf nodes in the Generation Tree if there exists no pendent vertex in the graph excluding the destination. Proof: The Generation Tree further fulfils the target to count all possible simple paths. Each Artificial Cell evolves or produces new cells as soon as it finds any of the necessities. Every edge of the DAG can only be visited by an Artificial Cell if it is a part of a unique simple path. The claim can be justified by observing the Generation Tree where every line of generation (e.g. C1→ C11→ C111→ C1111) is representing a new path from source to destination. Hence by Lemma 1, the total number of simple paths is equal to the total number of leaf nodes in the Generation Tree if there exists no pendent vertex in the graph excluding the destination. V. TIME COMPLEXITY ANALYSIS Considering the number of vertices in the given DAG to be „n‟, the complexity incurred due to line „3‟ and „4‟ is Ο(n). The analysis of the algorithm reveals that complexity is primarily dependent on line „1‟ and „2‟ which secure the condition to run further steps for all Artificial Cells at that moment in the DAG. Lemma 3. Total number of Artificial Cells in the DAG is variable.

Fig. 2. Generation Tree of Artificial Cells of the DAG depicted in Fig. 1(a).

Lemma 1. Every node except the leaf nodes of the Generation Tree is either participated in Artificial Cell division or evolved to a new Artificial Cell. Proof: From the Generation Tree it can be observed that for all non-leaf nodes there must be at least one necessity condition which has satisfied. Otherwise, it must have reached the destination or a pendant vertex. The later condition is implemented by line „2‟ of Counting Path algorithm. Significance of line „4‟ can be realized by observing the Generation Tree. It can be noted that for any node in DAG if there exist more than one originating edge, the 1st necessity condition is satisfied. For instance, C1 has produced three new

Proof: Line „3‟ and „4‟ of the algorithm implements the idea of Artificial Cell division. Hence after a discrete amount of time existing cells may find any of the following possibilities; Case I: Produce multiple Artificial Cells. It may significantly increase the number of cells in the DAG. Case II: May evolve. It doesn‟t increase the number of cells but also doesn‟t decrease it. Case III: May stop doing anything. The number of cells doesn‟t decrease. Hence by observing all possibilities it can be concluded that depending on the necessity conditions the number of cells can be varying in the DAG. To find the complexity due to line „1‟ and „2‟ it is important to find the upper bound of the number of cells that can be

Copy Right © INDIACom-2015; ISSN 0973-7529; ISBN 978-93-80544-14-4

6.239

Proceedings of the 9th INDIACom; INDIACom-2015; IEEE Conference ID: 35071 2015 2 International Conference on “Computing for Sustainable Global Development”, 11 th - 13th March, 2015 nd

produced. The worst case can be achieved by designing such a DAG which has maximum number of edges. A connected directed graph would serve the purpose. Considering that the first node n1 to be connected with rest of the nodes, node n 2 to be connected with all nodes except n1 (because an edge between n2 to n1 would create a cycle) and so on, maximum number of edges would be

TABLE I. COMPARATIVE ANALYSIS OF TIME TAKEN BY DFS & COUNTING_PATH ALGORITHM

(n  1)  (n  2)  ... 1



(n  1) * (n  1  1) 2

(n  1) * n 2 2  O( n )



Thus in worst case the overall complexity can go up to O(n3 ) . VI. RESULT & DISCUSSION In this section the proposed method of section IV has been implemented. A large number of experiments have been conducted with varying values of „n‟, where the values of „n‟ are randomly chosen positive integers. The experiments have been conducted in a Core 2 Duo Pentium IV machine with 2GB RAM.

Number of Nodes

Number of Edges

10 20 30 40 50 60 70 80 90 100 110 130 150 170 180 200 250 300 350 400 450 500 600 700 800 900 1000

45 190 435 780 1225 1770 2415 3160 4005 4950 5995 8385 11175 14365 16110 19900 31125 44850 61075 79800 101025 124750 179700 244650 319600 404550 499500

Time taken to solve (in seconds) Counting_ DFS Path 0.0 0.0 0.0 0.0 0.0 0.0 0.015 0.0 0.015 0.0 0.015 0.0 0.015 0.0 0.015 0.0 0.016 0.0 0.016 0.0 0.016 0.0 0.018 0.0 0.021 0.0 0.031 0.0 0.039 0.0 0.041 0.0 0.041 0.0 0.043 0.0 0.047 0.0 0.062 0.0 0.063 0.0 0.078 0.015 0.110 0.029 0.113 0.063 0.125 0.070 0.140 0.092 0.187 0.098

The performance of the algorithm is judged by using a wide range of randomly generated DAG of different sizes depending on the selected values of „n‟. The problems are solved by using conventional DFS algorithm and by Counting_Path algorithm. The results obtained are shown in Table I. where the first column from left shows the number of nodes of different DAGs, next column shows the number of edges corresponding to each DAG. Finally the third and fourth column depicts the time taken to solve the problem of the corresponding DAG by DFS and Counting_Path algorithms respectively. It can be noted that the increment of number of edges is far greater than the rate of increment of number of nodes. In all cases a connected DAG has been generated to take the worst case into consideration as described in the previous section. Fig. 3 Depicts a plot of Time vs. No. of nodes in DAG. It shows time taken by both algorithms under consideration to find the number of all possible paths between the source node „1‟ and destination node which is the node having index „number of nodes‟ (e.g. for instance for a DAG of size „10‟ destination is also „10‟). The plot reveals that the proposed algorithm always takes lesser time than conventional DFS algorithm.

Fig. 3. A plot of Time vs. No. of nodes in DAG. It shows the nature of both algorithms under consideration.

VII. CONCLUSION The purpose of the paper is to find whether the problem of counting all possible simple paths between two nodes of a

Copy Right © INDIACom-2015; ISSN 0973-7529; ISBN 978-93-80544-14-4

6.240

Counting All Possible Simple Paths using Artificial Cell Division Mechanism for Directed Acyclic Graphs

directed acyclic graph can be solved in polynomial time or not. The cell division algorithm which was created for this purpose is clearly Polynomial time algorithm. Hence it can be shown that the problem is in the set Polynomial time problems. The proposed work will be immensely helpful for those researchers who are working in the field of combinatorial optimization in near future.

REFERENCES [1] D. O. Morgan, “Cell Cycle: Principles of Control”, Yale Journal

of Biology and Medicine, Vol.80, No.3, pp.141-142,2008. [2] http://en.wikipedia.org/wiki/Cell_division [3] http://www.biologyreference.com/Gr-Hi/History Of-Biology-Cell-Theory-and-Cell-Structure.html [4] G.Leslie and Valiant, “The Complexity of Enumeration and Reliability Problems”, SIAM J. Comput, Vol.8, No.3, pp.410– 421, 1977. [5] Min-Sheng Lin, Sheng-Huang Su, “Counting maximal independent sets in directed path graphs”, Information Processing Letters, Vol.114, pp.568-572, 2014. [6] N.Creignou and M.Hermann, “Complexity of Generalized Satisfiability Counting Problems”, Information and computation, Vol.125, 112, 1996. [7] C. Wrathall, “Complete sets and the polynomial-time hierarchy”, Theoretical Computer Science, Vol.3, No. 1, pp. 23–33, 1976. [8] D.C.Kozen, “The design and analysis of algorithms, Counting problems and NP”, Springer-Verlag, pp. 138–143, 1992. [9] F.Markopoulou, and S. Severini, “A Note on Observables for Counting Trails and Paths in Graphs”, Journal of Mathematical Modelling and Algorithms, Vol.8, pp.335-342, 2009. [10] J.Scott Provan, and Michael O. Ball, “The Complexity of Counting Cuts and of Computing the Probability that a Graph is Connected”, SIAM J. Comput, Vol.12, No.4, pp.777–788, 1983. [11] Tian-Ming Bua, C.Yuanb, and P. Zhanga, “Computing on binary strings”, Theoretical Computer Science, (In press) [12] Y.Okamotoa, T.Unob, and R.Ueharac, “Counting the number of independent sets in chordal graphs”, Journal of Discrete Algorithms, Vol.6, pp.229-242, 2008. [13] A.T Amin, K.T Siegrist, and P.J Slater, “The expected number of pairs of connected nodes: Pair-connected reliability”, Mathematical and Computer Modelling, Vol.17, pp.1-11, 1993.

Copy Right © INDIACom-2015; ISSN 0973-7529; ISBN 978-93-80544-14-4

6.241