You are on page 1of 6

2020 IEEE 5th International Conference on Computing Communication and Automation (ICCCA)

Galgotias University, Greater Noida, UP, India. Oct 30-31, 2020

A Novel Agent Based Depth First Search Algorithm


Vigneshwaran Palanisamy Senthooran Vijayanathan
Department of Information and Communication Department of Information and Communication
Technology, Vavuniya Campus of the University of Jaffna, Technology, Vavuniya Campus of the University of Jaffna,
Sri Lanka Sri Lanka
p.vickey22@gmail.com senthooran@vau.jfn.ac.lk

Abstract- Artificial intelligent techniques provide different kind The solution to this problem is the central directory that
of searching methods in tree structure and those methods are provides request to clients. This centrally limited solutions
implemented sequential and parallel manner using structured restrict the autonomy of such agents regarding the partner
programming. Depth-first search is a tree search algorithm agent and affects the scalability of the multi-agent system. This
which enables the traversal from source node to neighbour nodes leads the grouping of agents based on similar objectives and it
adjacent to source node in a graph and implemented sequentially can be viewed as clustering problem in multi-agent system.
in this fashion. The improvement of the sequential Depth-first This research proposes the multi agent system to boost the
search is sought in several research studies. One of the solutions sequential depth first search algorithm experimentally by using
to the improvement of Depth-first search is the design of multi
bi-directed clustering technique on whole graphs. The rest of
agent system for the searching problem. In this research study,
the proposed multi agent system for Depth-first search divides
the paper outlines the background study in section II and
the entire graph into several clusters using bi-connected region related works in section III. The section IV presents the
method and consigns the agents to each cluster to perform the methodology with block diagram. The experimental results and
Depth-first search sequentially. The proposed method reveals the discussion is discussed in section V and conclusion with future
significance improvement in terms of the performance measure direction can be expanded in the section VI.
of the system than sequential Depth-first search.
II. BACKGROUND STUDY
Keywords— Depth-first search, Bi-connected clustering, Multi The method of solving tree search problem through
Agent Systems, Tree Structure artificial intelligence comprises the major process of defining
the state space, identifying start and goal state then finding the
I. INTRODUCTION path from source to goal via search space.
Depth-first search is a tree-based search which is the
A. Depth First Search
building block for wide range of graph applications. It finds all
the vertices accessible from a given vertex or source and DFS is about to start a source vertex s and travel the graph
shortest path from a source to all vertices in directed and level by level and it first visits all vertices which are adjacent to
undirected graphs [1]. It is an important graph search problem the s [5].
which is used to solve problems like inspecting network
structuring, topological sorting, planarity testing and
scheduling problems in computer science. Using agents, we Input: A graph and a starting vertex root of Graph
can expedite any problems that related to a machine, human or Output: Goal state. The parent links trace the shortest path
software. The output of rational agent is action based on the back to root
past and current precepts what it perceived up to date [2]. An 1: procedure DFS_iterative(G, v) is
agent is a program or given a graph situated in an environment 2: let S be a stack
starting from source node by considering its perception history 3: S.push(iterator of G.adjacentEdges(v))
and finds the series of actions for to reach the goal node. 4: while S is not empty do
Autonomous agents have developed as a main paradigm for 5: if S.peek().hasNext() then
solving different of computational problems. The agent is 6: w = S.peek().next()
performing to make change in the environment by updating the 7: if w is not labeled as discovered then
current state. Autonomous agents have developed to perform as 8: label w as discovered
a solution maker for solving various complex computational 9: S.push(iterator of G.adjacentEdges(w))
problems. While conventional software system is to be 10: else
monolithic and operated under centralized system, the multi- 11: S.pop()
agent system entails agents that interact with each other to Pseudocode 1: Pseudocode for finding DFS using sequential method [5]
attain common goal of the problem [3]. Agent technology is
one of the solutions to improve the complexity of the The Time complexity of DFS will be O (V + E), where V is
sequential depth first search algorithm in terms of reaching the number of vertices, and E is the number of Edges. This
goal node by traversing from source node where each nodes or again depends on the data structure that we user to represent
group of nodes represented as agents [4]. In the multi-agent the graph. If it is an adjacency matrix, it will be O (V2). If we
system, all the agents should find each other to communicate. use an adjacency list, it will be O (V+E) [13].

978-1-7281-6324-6/20/$31.00 ©2020 IEEE 443

Authorized licensed use limited to: University of Ghana. Downloaded on May 18,2021 at 20:11:17 UTC from IEEE Xplore. Restrictions apply.
B. JADE Environment with searching problems III. RELATED WORKS
JADE is the one of the most object-oriented frame work Some agent-based approaches for searching algorithms
and completely distributed system with a goal to enable the have been developed in the past. Most of the techniques uses
development of agent-oriented applications [6]. FIPA standards searching algorithms in multi-agent path finding problems
facilitates agent communication models and enables external [10]. Few related studies were proposed regarding the
behaviour of agents in the JADE platform. FIPA specification improvement of searching algorithms using agent technology.
includes agent communication, management and architecture. A general BFS solver in Netlogo was proposed by Fernando in
JADE provides two types of agents in order to facilitate the [11]. The sequential BFS algorithm is simulated by Netlogo
agentification [7]. First, Agent Management System (AMS) is using list data structure, turtles as agents, links to represent
the naming service and enables each agent with unique name transitions between the agents. Florin Lion proposed an agent-
and authority in the platform. It will create or eradicate agents based solution for searching problem [12]. This composes of
on remote containers by requesting AMS. Second, Directory three main classes of agents, namely, Environment, Solver and
Facilitator which is provides a yellow page that an agent can Requester. The Environment agent knows the structure of the
identify other agents providing the services it requires in order problem to be resolved. The Solver agent solves the searching
to solve its goals [8]. Further, in JADE, Agent base class run in problem. The Requester agent asks the solver agent for a
the containers and automatically called by the platform solution to the searching problem. This model allows more
invoking the agent life cycle, for each agent behaviors are Solver and Environment agents. In terms of FIPA
specified by the action method and agent communication is recommendations, the Environment agents and Solver agents
represented using ACL messages. JADE facilitates agent first register their services via the director facilitator in JADE.
models include communication graphs where each nodes In that way, the Solver agent finds the Environment agent and
represent agents and edges are represented communication Requester agent finds the solver agent.
between the agents with each other. an edge represents the
casual relationship and edges so as graph indicates the IV. METHODOLOGY
transmitted message. The proposed methodology clusters the whole graph into
C. Bi-Connected clustering several areas using bi-connected region method. This yields the
whole graphs into small pieces. The Depth-first search
Clustering is a technique assigning certain data points into operation is performed in each cluster and the visited nodes are
dissimilar clusters for highlighting the similarity of data points the input to the next cluster to perform the Depth-first search in
assigned to same cluster. the next cluster. Thus, the proposed design of the agent-based
Input: A graph G= (V, E) methodology enables the communication between two agents.
Output: Bi-connected components of G= (V, E) Typically, in the Fig.1, it can be divided into five clusters
which are assigned to five receiver agents to be performed. The
1: iÅ0
nodes belonging to each cluster are sent to the corresponding
2: SÅempty stack
receiver agent. The actual process of the agent-based design is
3: for x ‫ א‬V do num (x) Å0 working with sender agent and receiver agent. First, the sender
4: for x ‫ א‬V do if num (x) =0 then BICON (x,0) agent divides the whole graph into clusters using the bi-
5: procedure BICON(v,u) connected region clustering method and sends each cluster to
6: iÅ i+1 corresponding receiver agents that means that the sub graph
7: num(v)Å i related to the particular cluster is send to the corresponding
8: lowpt(v)Åi receiver agent. The receiver agents perform the depth-first
9: for w € Adj(v) do if num(w)=0 then search in clusters and get the result. Once, the receiver agent
10: [(v,w) is a tree edge] finishes its task the results is forwarded to second receiver
11: SÍ (v,w) agent. This is sequentially performed and until the last receiver
12: BICON (w,v) agent gets the results. Eventually, the sender agent will receive
13: lowpt(v)Å min(lowpt(v),lowpt(w)) the depth-first search result for the whole graph from last
14: if lowpt(w) ≥ num(v) then receiver agent. The design of this method consists of sender
15: form a new biconnected component consisting all the agent and number of receiver agents equivalent clusters and
edges on above stack and including (v,w) communication among the agents is sequential and
remove these edges from the stack broadcasting. Particularly each receiver agents will
16: else if num(w) < num(v) and w≠u then communicate next receiver agent and transfer the accumulated
17: [(v,w) is a back edge] result. The block diagram of the proposed design is portrayed
in Fig 2.
18: SÍ (v,w)
19: lowpt(v)Å min(lowpt(v),num(w))
20: return
Algorithm 1: Finding Biconnected region clustering for a Graph [9]

444

Authorized licensed use limited to: University of Ghana. Downloaded on May 18,2021 at 20:11:17 UTC from IEEE Xplore. Restrictions apply.
agent and find the results. Finally, it combines the whole results
to find the DFS of the whole graph.
N N
N N
Input: A graph G= (V, E)
Output: DFS result of G= (V, E)
N Cluster 3 N N N: Number of clusters
S: Sender agent
R: Receiver agent
luster 1 N Cluster 2 G= (V, E): Whole graph
1: S finds clustered Graph of G is C
N
N 2: S sends C to R(0)
3: R(0) perform the DFS to C(0)
N 4: Combine the result with C
N 5: for iÆ 1 to N
6: R(i) perform the DFS to C(i)
N N
N N N 7: Combine the result with C(N-1)
N 8: R(N-1) sends combine result to S
N N
9: S finds the DFS of G
Algorithm 2: Find the DFS of a graph using Multi agent system

Cluster 4 Cluster 5
V. RESULTS AND DISCUSSION
The proposed method is investigated using the JADE
Fig. 1. Clustered graph of an un-directed graph platform. The efficacy of the proposed method is evaluated in
terms of Total calculation time in nano seconds, Number of
Clustered graph communications among the agents and the Average
communication time. The graphs depicted in Fig.3, Fig.4, Fig.5,
Fig.6, Fig.7, and Fig.8 with various number of nodes are
considered for experimentation. The results of the experiments
SC R1 show the noteworthy improvement compared with sequential
depth-first search algorithm in terms of the above-mentioned
Result of Result of performance measures. The number of communications among
cluster 2 + rest cluster 1 + rest the agents are tested and it shows the comparison of the
of clusters of clusters proposed method with sequential method in Fig.9, Fig.10 and
Fig.11.
The time complexity of the DFS is V+E, where V is the
number of vertices and E is the number of edges. In agent based
R3 DFS, we model the time complexity as Tc+Ta*n, where Tc is
R2 the total time taken for the clustering and Ta is the calculation
Result of
cluster 3 + rest of the DFS in agent and n is the number of agents. Time
complexity of this algorithm will be as following for Tc, O
of clusters
(V+E) and for Ta, O (V+E). Therefore, total time complexity
of O (V+E) + n* O (V+E), which will be the time complexity
of O (V+E). In this comparison, it is clearly shown that the total
calculation time for agent-based implementation less than total
Result of calculation time for sequential based implementation (as shown
R4 R5 in Fig.9). For Fig.3, the number of nodes is higher than other
cluster 4 + rest
graphs. Therefore, the total calculation time for agent-based
of clusters
implementation for this graph is comparatively higher than
agent-based implementation for other graphs. For all the graphs
total calculation time for agent-based implementation based on
the number of nodes as shown in Table 1. As the result of the
Result of cluster 5 + combined results
total calculation time between both implementations show
Fig. 2. Flow diagram of implementation of the method using agent higher variation. In Fig.10, Number of communications are
technology evaluated for all the graphs. These number of communications
are depending on the number of nodes in the graphs and density
The experimental strategy of the proposed method creates of the clusters. For an example in Fig.3 and Fig.6, there are
the number of agents which are equivalent to the number of same number of nodes but the densities of each clusters are
clusters, then sends the clustered graphs to the receiver agents different, therefore Fig.3 have a greater number of
from the sender agent. The DFS is performed in each receiver communications than Fig.6. Further the comparison of average

445

Authorized licensed use limited to: University of Ghana. Downloaded on May 18,2021 at 20:11:17 UTC from IEEE Xplore. Restrictions apply.
communication time for agent-based implementation and
average communication time for sequential based
implementation are shown in Fig.11. From this investigation,
the agent-based method is comparatively good rather than the
sequential DFS algorithm. The existing sequential DFS
algorithm consumes more time than the proposed agent
method. The agent-based DFS method can be real world
applications like Broadcasting, Peer to Peer Networking, GPS
Navigation System, Web Crawlers and Path finding.

Fig. 5. Undirected graph with 10 nodes

Fig. 6. Undirected graph with 20 nodes

Fig. 3. Undirected graph with 20 nodes

Fig. 7. Directed graph with 6 nodes

Fig. 4. Undirected graph with 11 nodes

Fig. 8. Undirected graph with 10 nodes

446

Authorized licensed use limited to: University of Ghana. Downloaded on May 18,2021 at 20:11:17 UTC from IEEE Xplore. Restrictions apply.
VI. CONCLUSION
This research study addresses a new method for finding
Depth-first search using agent-based technology with the proof
of experimental results compared with sequential DFS
algorithm. The performance measure of the proposed method
has been evaluated in terms of various aspects such as total
calculation time, number of communications between agents
and average communication time. The experimental results
show the significant improvement in the calculation time and
the average communication time with respect sequential
algorithm.
Fig. 11. Evaluation for the implementation of sequential based algorithm and
agent-based algorithm in terms of Average communication time

Eventually, it is clearly seeming that the agent-based


implementation of the Depth-first search is more efficient than
the sequential based implementation and the proposed cluster
based multi agent method will be used for real worlds
applications occupied with Depth-first search.

TABLE I. TOTAL CALCULATION TIME FOR AGENT BASED


IMPLEMENTATION
Fig. 9. Evaluation for the implementation of sequential based algorithm and
Number of
agent-based algorithm in terms of Total calculation time Graphs Total calculation time (x109 ns)
nodes
Fig.3 20 0.4808953

Fig.4 11 0.3063890

Fig.5 10 0.3761059

Fig.6 20 0.4143355

Fig.7 6 0.2504957

Fig.8 10 0.2997649

REFERENCES.

[1] G. G. A. a. V. S. Cong, 2010, "Fast PGAS implementation of distributed


Fig. 10. Evaluation for the implementation of agent-based algorithm in terms graph algorithms," in Proceedings of the International Conference for
of Number of communications High Performance Computing, Networking,Storage and Analysis, pp: 1-
11.
It is clearly proved the high variation in the total calculation [2] K.-H. C. W. a. A. Botea, 2011,"MAPP: a Scalable Multi-Agent Path
time between agent-based implementation and sequential based Planning Algorithm with Tractability and Completeness Guarantees,"
implementation. The number of nodes were the variables to Journal of Artificial Intelligence Research (JAIR), vol. 42, pp. 55-90.
investigate the average communication time between the two [3] C. M. W. a. A. Botea, 2014, "Spatially Distributed Multiagent Path
methods. If the number of nodes increased, the average Planning," in In International Conference on Automated Planning and
communication time shows the variation in both methods. The Scheduling (ICAPS), 332–340.
proposed agent-based method reveals the considerable [4] T. C. S. a. M. Balduccini, 2018, "Answer Set Planning in Single- and,"
performance than sequential method. The number of Künstliche Intelligenz (KI), vol. 32, no. 2-3, pp. 133-141.
communications between the agents are proportional when the [5] E. F. Moore, 1959, "The Shortest Path Through a Maze," in International
number of nodes increased. However, the number of clusters Symposium on the Theory of Switching, 285–92.
are increased the number of communications among the agents [6] F. L. C. G. G. D. Bellifemine, "Developing Multi-Agent Systems with
are increased. JADE," Wiley Series in Agent Technology, 2007.
[7] G. Caire, "JADE Tutorial: JADE Programming for Beginners," TILAB
Jade Support Team, 2003.

447

Authorized licensed use limited to: University of Ghana. Downloaded on May 18,2021 at 20:11:17 UTC from IEEE Xplore. Restrictions apply.
[8] "FIPA," FIPA SL Content Language Specification,
http://www.fipa.org/specs/fipa00008/SC00008I.html 2002.
[9] N. D. Regingold, "Combinational Algorithms".[Online]. Available:
https://www.cs.cmu.edu/~avrim/451f12/lectures/biconnected.pdf.
[Accessed: 28- April- 2020].
[10] P. S. A. F. H. M. T. K. S. K. a. S. Jiaoyang Li, 2019,"Multi-Agent Path
Finding for Large Agents," in In AAAI Conference on Artificial
Intelligence, 7627–7634.
[11] "http://BFS/A general BFS Solver in NetLogo Fernando Sancho
Caparrini.html".
[12] F. Leon, "Design of a Multiagent System for Solving Search Problems,"
Journal of Engineering Studies and Research, August 2010.
[13] Sedgewick and Robert, “Algorithms in C++: Graph Algorithms (3rd
ed.)", Pearson Education, ISBN 978-0-201-36118-6, 2002.

448

Authorized licensed use limited to: University of Ghana. Downloaded on May 18,2021 at 20:11:17 UTC from IEEE Xplore. Restrictions apply.

You might also like