\documentclass[runningheads]{llncs}
\usepackage{graphicx}
 % \usepackage{geometry}
 % \geometry{
 %   a4paper,         % or letterpaper
 %  textwidth=13cm,  % llncs has 12.2cm
 %   textheight=22cm, % llncs has 19.3cm
 %   heightrounded,   % integer number of lines
 %   hratio=1:1,      % horizontally centered
 %   vratio=13:10,      % not vertically centered
 % }
\usepackage{mathrsfs}
\usepackage{esvect}
\renewcommand{\arraystretch}{1.5} % increases row height
\setlength{\tabcolsep}{3pt}
\usepackage{bm}
\usepackage{cite,comment}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{graphicx}
\usepackage{bm}

\usepackage{caption}
\usepackage[dvipsnames]{xcolor}
\usepackage{subcaption}
\usepackage{textcomp}
\usepackage{xcolor,enumerate}
\usepackage{multicol}

\usepackage[noend,linesnumbered,ruled,lined]{algorithm2e}
\SetAlFnt{\scriptsize}

\usepackage{makecell}
\usepackage{lipsum}
\renewcommand\theadalign{bc}

\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}
\usepackage[noend,linesnumbered,ruled,lined]{algorithm2e}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{amsfonts}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{url}
\usepackage{mathrsfs}
\usepackage{comment}
\usepackage{enumitem}
\usepackage{lineno}
\usepackage{bm}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}

\usepackage{textcomp}
\usepackage{xcolor,enumerate}
\usepackage{makecell}
\usepackage{lipsum}
\newtheorem{observation}{Observation}
\renewcommand\theadalign{bc}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}


\renewcommand{\thesubfigure}{Figure \arabic{subfigure}}
\captionsetup[subfigure]{labelformat=simple, labelsep=colon}

\usepackage{orcidlink}

\title{When Agents are Powerful: \\Black Hole Search in Time-Varying Graphs}
\titlerunning{Black Hole Search in Time-Varying Graphs}

%\author{}
%\institute{}

\author{Tanvir Kaur\inst{1}\orcidlink{0009-0002-3651-994X}\and
Ashish Saxena\inst{1}\orcidlink{0009-0007-4767-8862}}
\authorrunning{Tanvir Kaur and Ashish Saxena}

\institute{Indian Institute of Technology Ropar, Rupnagar - 140001, Punjab, India}


\begin{document}
\maketitle
% \documentclass[runningheads]{llncs}
% \usepackage{amssymb}
% \setcounter{tocdepth}{3}
% \usepackage{graphicx}
% \usepackage{amsfonts}
% \usepackage{caption}
% \usepackage{subcaption}
% \usepackage{url}
% \usepackage{xcolor}
% \usepackage{mathrsfs}
% \usepackage{comment}
% \usepackage{enumitem}
% \usepackage{lineno}
% \usepackage{bm}
% \usepackage{cite}
% \usepackage{amsmath,amssymb,amsfonts}
% \usepackage{graphicx}
% \usepackage{caption}
% \usepackage{subcaption}
% \usepackage{textcomp}
% \usepackage{xcolor}
% \usepackage{makecell}
% \usepackage{lipsum}
% \usepackage{multirow}
% \usepackage[ruled,vlined]{algorithm2e}

% %\newtheorem*{problemd}{Problem definition}
\newtheorem{myclaim}{Claim}
% %%%%%%%%%%%%%%%%%%


% %\usepackage[noend,linesnumbered,ruled,lined]{algorithm2e}
% \renewcommand{\thefootnote}{\roman{footnote}}
% %\renewcommand\theadalign{bc}
% %\renewcommand\theadfont{\bfseries}
% %\renewcommand\theadgape{\Gape[4pt]}
% %\renewcommand\cellgape{\Gape[4pt]}
% \newtheorem{observation}{Observation}
% \newtheorem{result}{Result}
% \begin{document}
% \mainmatter

% \title{When Agents are Powerful: \\Black Hole Search in Time-Varying Graphs}


% \titlerunning{Black Hole Search in Time-Varying Graphs}
% \author{}
% \authorrunning{Anonymous et al.}
% \institute{}

% \maketitle

\begin{abstract}
A black hole is a harmful node in a graph that destroys any resource entering it, making its identification a critical task. In the \emph{Black Hole Search (BHS)} problem, a team of agents operates on a graph $G$ with the objective that at least one agent must survive and correctly identify an edge incident to the black hole. Prior work has addressed BHS in arbitrary dynamic graphs under the restrictive \emph{face-to-face} communication, where agents can exchange information only when co-located. This constraint significantly increases the number of agents required to solve the problem. In this work, we strengthen the capabilities of agents in two ways: (i) granting them \emph{global communication}, enabling interaction regardless of location, and (ii) equipping them with \emph{1-hop visibility}, allowing each agent to observe its immediate neighborhood. These enhancements lead to more efficient solutions for the BHS problem in dynamic graphs. 
\keywords{Dynamic Graphs,
Black Hole Search,
Mobile Agents,
Distributed Algorithms,
Deterministic Algorithms.}
\end{abstract}

\section{Introduction}
In many distributed systems, a network cannot be assumed to be fully reliable. Real-world systems are prone to faults: agents may crash, communication links may intermittently fail, or nodes may behave maliciously, including corrupting data or destroying visiting agents. One particularly dangerous fault is a \emph{hostile node} that destroys any agent entering into it, without leaving any trace of its destruction. Such a node (denoted with $v_{BH}$) is called a \emph{black hole}. In the literature, two variants of the \emph{Black Hole Search (BHS)} problem have been studied: (i) at least one agent must survive and produce a map of the network indicating all edges leading to $v_{BH}$, and  
(ii) at least one agent must survive and learn \emph{at least one} edge that leads to $v_{BH}$. The BHS problem has been extensively studied on static graphs \cite{bhs_tokens, complexity_black_hole, Paola_2006}.

Recently, researchers have begun to study fundamental distributed problems like exploration \cite{Nicolo_21}, dispersion \cite{dynamic_dispersion}, and gathering \cite{LunaTCS2020} in \emph{dynamic graphs}, which better reflect real-world networks. In the synchronous setting, where time is considered in discrete rounds, a dynamic graph $\mathcal{G}$ is modeled as a sequence of static graphs $\mathcal{G}_0, \mathcal{G}_1, \mathcal{G}_2, \ldots$, where $\mathcal{G}_r$ is the graph at round $r$. This evolving sequence is called a \emph{time-evolving graph} or \emph{dynamic graph}.

A natural question that arises is whether the first variant of the Black Hole Search (BHS) problem is solvable in dynamic graphs. The answer is negative: since an edge leading to node $v_{BH}$ may not be present in every round $r \geq 0$, it is impossible to guarantee the identification of all such edges. Consequently, only the second variant of the BHS problem remains meaningful in dynamic graphs. This is the variant addressed in existing literature in dynamic graphs \cite{Adri_tori, BHS_gen}. While several results have been established for restricted classes of dynamic graphs, only one study considers the case of \emph{general dynamic graphs} \cite{BHS_gen}. In that work, it is ensured that at least one agent reaches a neighbor of $v_{BH}$ and identifies a port leading to $v_{BH}$. In this paper, we study the following problem.
\begin{definition}
  A black hole is said to be found if at least one agent reaches a neighbour of \( v_{BH} \), say $v$, and identifies a port $p$ from node $v$ that leads to $v_{BH}$.
\end{definition}

This definition is stronger than the existing one, as it requires an agent to physically reach a neighbour \(v\) of node \(v_{BH}\), and identify the specific port at \(v\) that leads to \(v_{BH}\). The \underline{motivation} behind this definition: information written on a whiteboard can be tampered with or erased by the adversary. If that happens, future agents entering the network might unknowingly fall into node $v_{BH}$ and die. To prevent this, we place a \emph{checkpoint agent} at \(v\). This agent does not move; it serves as a persistent witness that can reliably inform others about the dangerous port. One natural extension is to place agents as much as possible in the neighbours of \(v_{BH}\), because in dynamic graphs, at least one of the incident edges of \(v_{BH}\) might never appear during the entire execution of the algorithm. Even if agents know the full topology, reaching the right neighbours at the right time can be hard in a changing network, making this extension non-trivial.

Most previous works on the BHS problem assume the \textit{face-to-face} (f-2-f), where agents can communicate only when located at the same node \cite{Luna_2025,bhattacharya_2023,Adri_tori, BHS_gen}. This restriction limits coordination and often increases the number of agents or the time required to solve the problem. In contrast, we study the BHS problem under two stronger models: (i) the \textit{global communication model}, where agents can communicate regardless of their positions, and (ii) the \textit{1-hop visibility model}, where each agent can observe its one-hop neighbourhood, including the presence of agents at neighbouring nodes. Although these models provide more power than f-2-f communication, they also introduce new challenges. For instance, in the global communication model, agents can talk to each other but lack knowledge of the network’s structure, so they cannot determine how to physically reach one another. The \underline{motivation} for this assumption is to narrow the gap in the number of agents required for solving the 1-BHS problem. Similar strong assumptions have been used in several distributed computing works \cite{disp_global,shantanu_broadcasting} to find efficient solutions to the problem, even when they are not strictly essential. To the best of our knowledge, this is the first study of the BHS problem under models beyond f-2-f communication. In the next section, we give a detailed model description and the problem definition.


\subsection{Model and the problem}
\noindent \textbf{Dynamic graph model}: A dynamic network is modeled as a \emph{time-varying graph (TVG)}, denoted by \( \mathcal{G} = (V, E, T, \rho) \), where \( V \) is a set of nodes, \( E \) is a set of edges, \( T \) is the temporal domain, and \( \rho : E \times T \rightarrow \{0, 1\} \) is the presence function, which indicates whether a given edge is available at a given time. The static graph \( G = (V, E) \) is referred to as the underlying graph (or footprint) of the TVG \( \mathcal{G} \), where \( |V| = n \) and \( |E| = m \). For a node \( v \in V \), let \( E(v) \subseteq E \) denote the set of edges incident on \( v \) in the footprint. The degree of node \( v \) is defined as \( \deg(v) = |E(v)| \). Nodes in $V$ are anonymous. Each node is equipped with storage, and each edge incident to a node \( v \) is locally labeled with a port number. This labeling is defined by a bijective function \( \lambda_v : E(v) \rightarrow \{0, \ldots, \delta_v - 1\} \), which assigns a distinct label to each incident edge of \( v \). Assuming that the time is discrete, the TVG \( \mathcal{G} \) can be viewed as a sequence of static graphs \( \mathcal{S}_{\mathcal{G}} = \mathcal{G}_0, \mathcal{G}_1, \ldots, \mathcal{G}_r, \ldots \), where each \( \mathcal{G}_r = (V, E_r) \) denotes the snapshot of \( \mathcal{G} \) at round \( r \), with \( E_r = \{ e \in E \mid \rho(e, r) = 1 \} \). The set of edges not present at time \( r \) is denoted by \( \overline{E}_r = E \setminus E_r \subseteq E \). There is a node $v_{BH}$ in $G$ which is a black hole, and its degree is donoted by $\delta_{BH}$. A node that is not a black hole, we call it a \underline{safe node}.
Dynamic graphs can be classified based on how their topological changes affect connectivity. One well-known class of dynamic graphs guarantees connectivity at every round, rather than over time. A commonly used restriction is 1-interval connectivity, and a further refinement is its bounded variant.

\begin{definition}
 (\( \ell \)-bounded 1-interval connectivity) A dynamic graph \( \mathcal{G} \) is \emph{1-interval connected} (or \emph{always connected}) if every snapshot \( \mathcal{G}_r \in \mathcal{S}_\mathcal{G} \) is connected. Furthermore, \( \mathcal{G} \) is said to be \( \ell \)-bounded 1-interval connected if it is always connected and \( |\overline{E}_r| \leq \ell\).
\end{definition}

\noindent\textbf{Agent}: We consider $k$ agents to be present arbitrarily at safe nodes of the graph $G$ in the initial configuration. Each agent has a unique identifier assigned from the range $[1,\,n^c]$, where $c$ is a constant. Each agent knows its ID but is unaware of the other agents' IDs. Agents are not aware of the values of \( n \), \( k \), or \( c \) unless stated otherwise. The agents are equipped with memory. An agent residing at a node, say $v$, in round $r$ knows $\deg(v)$ in the footprint $G$ and all associated ports corresponding to node $v$ in $G$; however, the agent does not understand if any incident edge of node $v$ is missing in $\mathcal{G}$ in round $t$. To be more precise, agent $a_i$ currently at node $v$ at round $r$ does not know the value of $\rho(e_v,r)$, where $e_v$ is an edge incident at node $v$. Such a model has been considered in \cite{GOTOH_2021}.\\


\noindent \textbf{Communication model:} We consider two communication models: (i) face-to-face (f-2-f) communication~\cite{Augustine_2018}, meaning agents can only communicate if they are co-located at the same node, and (ii) global communication~\cite{Ajay_dynamicdisp}, allowing agents to exchange messages regardless of their positions in the network.\\


\noindent \textbf{Visibility model:} We use three types of visibility models: 0-hop visibility, 1-hop visibility and full visibility. In the 0-hop visibility~\cite{Augustine_2018}, an agent at a node \( v \in \mathcal{G} \) can see the IDs of agents present at \( v \) in round \( r \), as well as the port numbers at \( v \), but nothing beyond that. In the 1-hop visibility model~\cite{Agarwalla_2018}, an agent \( a_i \) at node \( v \) can also see all neighbors of \( v \), including the IDs of agents (if any) at those neighboring nodes. Let \( e_v \) be an edge incident to node \( v \). In the 0-hop visibility model, agents cannot determine the value of \( \rho(e_v, r) \) at the beginning of round \( r \). In contrast, under the 1-hop visibility model, they can determine this value at the beginning of round \( r \). In full visibility, at round $r$, the agent can see $\mathcal{G}_r$ as well as agents' positions in $\mathcal{G}_r$. 

\noindent The algorithm runs in synchronous rounds. In each round $t$, an agent $a_i$ performs one \textit{Communicate-Compute-Move} (CCM) cycle as follows:
\begin{itemize}
    \item \textbf{Communicate:} Agent $a_i$ at node $v_i$ can communicate with other agents $a_j$ present at the same node $v_i$ or present at any different node $v_j$, depending on the communication model used. The agent also understands whether it had a successful or an unsuccessful move in the last round.
    \item \textbf{Compute:} Based on the information the agent has, the agent computes the port through which it will move or decides not to move at all.
    \item \textbf{Move:} Agent moves via the computed port or stays at its current node. 
\end{itemize}

\begin{problem}
    \textbf{(1-BHS)} Let $\mathcal{G}$ be a 1-bounded 1-interval connected dynamic graph. Suppose $k$ agents are initially placed at safe nodes of $G$. The 1-BHS problem is said to be solved if at least one agent is guaranteed to reach a neighbour, say $v$, of node $v_{BH}$ and identify a port that from node $v$ leads to $v_{BH}$.
\end{problem}

\begin{table}[ht]
\centering
\scriptsize
\setlength{\tabcolsep}{2.3pt}
\renewcommand{\arraystretch}{2} % better spacing in rows
\caption{Summary of existing results on general graphs and our contributions. Here, and IC denotes the initial configuration.}
\begin{tabular}{ccccccc}
\hline
\textbf{Capability} & \textbf{IC} & \textbf{Problem} & $\bm{k}$ & \textbf{Node storage} & \textbf{Agent memory} & \textbf{Time complexity} \\ \hline \hline


\makecell{f-2-f Comm, \\ 0-hop visibility  \cite{BHS_gen}} 
& Rooted & 1-BHS & 9 & $O(\log n)$ & $O(\log n)$ & $O(m^2)$ \\ 

\makecell{Global Comm, \\ full visibility \\(This work)~} 
& Rooted & 1-BHS & 3 & Infinite & Infinite & Impossible \\ 

\makecell{f-2-f Comm, \\ 1-hop visibility \\(This work)} 
& Rooted & 1-BHS & 4 & $O(\log n)$ & $O(\log n)$ & $O(m^2)$ \\ 

\makecell{Global Comm, \\ full visibility \\(This work)} 
& Scattered & 1-BHS & $\delta_{BH}+1$ & Infinite & Infinite & Impossible \\ 

\makecell{Global Comm, \\ 0-hop visibility \\ (This work)}
& Scattered & 1-BHS & $\delta_{BH}+2$ & $O(\log n)$ & $O(\log n)$ & $O(\delta_{BH}\cdot m^2)$ \\ \hline
\end{tabular}
\label{tb:1}
\end{table}

\subsection{Related work}
The BHS problem was first introduced by Dobrev et al. \cite{Paola_2006}. In this work, the authors consider static, arbitrary graphs and focus on generic solutions. They also consider the asynchronous model, i.e., every action taken by the agents requires a finite but unpredictable time. They analyse the number of agents required to solve the problem and also the conditions for their existence. Furthermore, the problem of BHS on static graphs is extensively studied \cite{Pelc_2005, Paola_2010, Shantanu_2011,  
 Paola_2006, MarkouP12}. 
 
 BHS on dynamic graphs was first studied by Di Luna et al. \cite{Luna_2021}. They studied the problem on dynamic rings, and their objective is that at least one agent survives and learns at least one edge associated with $v_{BH}$. Later, this problem is studied in two graph classes: cactus \cite{bhattacharya_2023}, and tori \cite{Adri_tori}. Recently, the problem of BHS has been studied on arbitrary graphs in \cite{BHS_gen}. The authors in \cite{BHS_gen} provide impossibility results for both $1$-BHS and $f$-BHS. \footnote{In the $f$-BHS problem, $\mathcal{G}$ is an $f$-bounded 1-interval connected dynamic graph.} They prove the impossibility of solving $1$-BHS with $2\delta_{BH}$ many agents arbitrarily placed on safe nodes of $G$ (arbitrary configuration), provided that the agents have $O(\log n)$ memory and the nodes have a whiteboard of $O(\log \delta_v)$ storage. They also provide an algorithm to solve $1$-BHS with $9$ agents that are co-located at a safe node of $G$ (rooted configuration) in $O(|E|^2)$ time. For their algorithm, the agents require $O(\log n)$ memory, and each node is equipped with a whiteboard of storage $O(\log n)$. In this work, we extend the study of the $1$-BHS problem on arbitrary graphs by equipping the agents with more powerful capabilities. We present optimal results with respect to the number of agents required to solve the problem. Refer to Table \ref{tb:1} to see the results of \cite{BHS_gen} and our results in this work. 


\subsection{Our contribution}
In this work, we establish the following four results:
\begin{enumerate}
    \item It is impossible for three agents starting from the rooted configuration to solve the 1-BHS problem, even if the agents have full visibility, global communication, infinite memory, and the nodes have infinite storage (Theorem~\ref{thm:imp1}).
    \item It is impossible for $\delta_{BH}+1$ agents, starting from a scattered configuration, to solve the 1-BHS problem even with full visibility, global communication, infinite memory, and infinite node storage (Theorem~\ref{thm:imp2}).
    \item We design an algorithm that solves 1-BHS using four agents starting from a rooted configuration, where each agent has 1-hop visibility, f-2-f communication and $O(\log n)$ memory, and each node has $O(\log n)$ storage (Theorem~\ref{thm:1-hop}).
    \item We design an algorithm that solves 1-BHS using $\delta_{BH}+2$ agents starting from any configuration, where each agent has global communication, 0-hop visibility and $O(\log n)$ memory, and each node has $O(\log n)$ storage (Theorem~\ref{thm:global}).
\end{enumerate}




\begin{figure}[!t]
    \centering
    \includegraphics[width=0.4\linewidth]{ICDCIT_1.pdf}
    \caption{The construction of graph $G$ for $n=10$.}
    \label{fig:imp1}
\end{figure}









\section{Impossibility results}
In this section, we provide the impossibility results.
\begin{theorem}\label{thm:imp1}
It is impossible for $3$ agents that are co-located at a safe node of the graph $G$ with $n~(\geq10)$ nodes to solve the problem of 1-BHS even if the agents have full visibility, global communication and infinite memory, and the nodes have infinite storage.
\end{theorem}
\begin{proof}
Let the size of the graph \( G \) be \( n \), and without loss of generality, assume \( n - 1 = p^2 \) for some integer \( p \). Construct \( G \) as follows: there are \( p \) cliques \( CL_1, CL_2, \ldots, CL_p \), each of size \( p \), and an additional node \( v_{BH} \) representing a black hole. Let \( v_1 \in CL_1 \), \( v_p \in CL_p \), and add edges \( e = (v_{BH}, v_1) \), \( e' = (v_{BH}, v_p) \). For interconnecting the cliques, define connector nodes as follows: let \( w_1^{(1)} \in CL_1 \) with \( w_1^{(1)} \neq v_1 \); for \( 2 \leq i \leq p-1 \), let \( w_1^{(i)}, w_2^{(i)} \in CL_i \); and let \( w_1^{(p)} \in CL_p \) with \( w_1^{(p)} \neq v_p \). Define edges \( e_1 = (w_1^{(1)}, w_1^{(2)}) \), \( e_i = (w_2^{(i)}, w_1^{(i+1)}) \) for \( 2 \leq i \leq p - 2 \), and \( e_{p-1} = (w_2^{(p-1)}, w_1^{(p)}) \). Refer Fig. \ref{fig:imp1} for $n=10$. 

Assume \( G \) is the footprint graph, and all three agents start at a node in \( CL_1 \). The adversary can remove at most one edge per round and uses the following strategy: if two or more agents are in \( CL_1 \), the adversary removes edge \( e \); if two or more agents are in \( CL_p \), the adversary removes edge \( e' \). This ensures that when agents are near \( CL_1 \), access to \( v_{BH} \) via \( e \) is blocked, and similarly, access via \( e' \) is blocked when they are near \( CL_p \).

Agents can access \( v_{BH} \) only in the following two cases: (1) agent \( a_i \), $i\in \{1,2,3\}$, is in \( CL_1 \) while \( \{a_1,a_2, a_3\}\setminus\{a_i\} \) are in \( CL_j \) for \( 2 \leq j \leq p \); or (2) agent \( a_i \), $i\in \{1,2,3\}$, is in \( CL_p \) while \( \{a_1,a_2, a_3\}\setminus\{a_i\} \) are in \( CL_j \) for \( 1 \leq j \leq p - 1 \). In Case 1, without loss of generality, let \( a_1 \) move to \( v_{BH} \) at round \( t \) via edge \( e \) and is destroyed. At round \( t_1 \geq t \), if \( a_2 \) or \( a_3 \) is at node \( w_1^{(2)} \), the adversary deletes edge \( e_1 \), preventing access to \( CL_1 \). Thus, the remaining agents cannot reach the neighbour of \( v_{BH} \) in $CL_1$. The only remaining possibility is to approach \( v_{BH} \) via edge \( e' \), but if both agents move to \( CL_p \), the adversary deletes \( e' \), and they can never observe which port leads to $v_{BH}$. Without loss of generality, assume that \( a_2 \in CL_j \) for \( 2 \leq j \leq p - 1 \) and \( a_3 \in CL_p \). If \( a_3 \) moves via edge \( e' \) at round \( t' \) and dies, then at any round \( t \geq t' \), if \( a_2 \) is at \( w_2^{(p-1)} \), the adversary deletes \( e_{p-1} \), and if \( a_2 \) is at \( w_1^{(2)} \), it deletes \( e_1 \). In this way, \( a_2 \) is confined within \( CL_2, \ldots, CL_{p-1} \) and never reaches a neighbor of \( v_{BH} \).Note that the above argument is valid if there are at least three cliques (i.e., $p\geq 3$). Therefore, $n\geq 10$ as $n-1= p^2$.

The argument for Case 2 is analogous to Case 1. Hence, under this adversary strategy, no agent can reach a neighbour of \( v_{BH} \) and identify the port leading to it. The argument holds regardless of the agents' memory, the nodes' storage, or the use of full visibility or global communication. This completes the proof. \qed
\end{proof}


\begin{theorem}\label{thm:imp2}
($n\geq 82$) It is impossible for \(\delta_{BH} + 1\) agents, scattered at the safe nodes of the graph, to solve the 1-BHS problem even if agents have full visibility, global communication, infinite memory, and the nodes have infinite storage.
\end{theorem}


\begin{proof}
Let the graph \( G \) have \( n= p^4+1 \) nodes and let the degree of node \( v_{BH} \) be \( \deg(v_{BH}) = p^2 \). Construct \( G \) as follows.

Let \( u_1, u_2, \ldots, u_{p^2} \) be the neighbours of \( v_{BH} \). Place one agent on each \( u_i \) for \( 2 \leq i \leq p^2 \), and two agents on \( u_1 \). Let \( G \) contain \( p \) cliques \( CL_1, CL_2, \ldots, CL_p \), each of size \( p \), disjoint from \( v_{BH} \) and its neighbours. Let \( v_1 \in CL_1 \), \( v_p \in CL_p \), and define edges \( e = (u_1, v_1) \) and \( e' = (u_2, v_p) \). To connect the cliques linearly, let \( w_1^{(1)} \in CL_1 \) with \( w_1^{(1)} \ne v_1 \). For \( 2 \leq i \leq p - 1 \), let \( w_1^{(i)}, w_2^{(i)} \in CL_i \), and let \( w_1^{(p)} \in CL_p \) with \( w_1^{(p)} \ne v_p \). Define the connecting edges as follows: $e_1 = (w_1^{(1)}, w_1^{(2)}),
e_i = (w_2^{(i)}, w_1^{(i+1)}) \text{ for } 2 \leq i \leq p - 2,
e_{p-1} = (w_2^{(p-1)}, w_1^{(p)}).$

By Theorem~\ref{thm:imp1}, the agents at \( u_1 \) and \( u_2 \) cannot determine the location of $v_{BH}$. An agent on any \( u_i \) either stays there forever or enters \( v_{BH} \) and is destroyed, in which case no other agent can access \( u_i \) again. Therefore, no agent can reach a neighbour of \( v_{BH} \) and identify the port leading to it. The argument holds regardless of the agents' memory, the nodes' storage, or the use of full visibility or global communication. Since the proof depends on Theorem \ref{thm:imp1}, the value of $p$ is at least 3. Hence, $n\geq 82$ as $n=p^4+1$. This completes the proof. \qed
\end{proof}


\section{Algorithm using 1-hop visibility}\label{sec:onehop}
In this section, we provide an algorithm that solves the problem of 1-BHS using 4 agents that are initially present at a single node and have 1-hop visibility, and are equipped with f-2-f communication. We use the idea from \cite{dyn_disp} where the authors ensure the dispersion of agents on a time-varying graph despite the presence of dynamic edges. They use depth-first search (DFS) traversal by mobile agents. For the sake of completeness, we begin with providing a high-level idea of the DFS traversal by mobile agents. Depth-First Search (DFS) operates in two fundamental states: $explore$ and $backtrack$. Note that an agent $a_i$ requires some parameters to execute the DFS algorithm. The parameter $a_i.ID$ stores the ID of agent $a_i$. The parameter $state$ stores the state the agent is currently working in. It can take the value either $explore$ or $backtrack$. The parameter $prt\_in$ stores the port used by the agent to enter into the current node, and the parameter $prt\_out$ stores the port that will be used by the agent to exit from the current node. The agent begins in the $explore$ state. In each state at the current node $v$, the movement of agents is described in Algorithm \ref{algo:DFS}. Any static graph $G$ with $m$ edges can be explored by an agent within $4m$ rounds using DFS \cite{Das__2019}.


\begin{algorithm}
\caption{Depth-First Search by an agent $a_i$}\label{algo:DFS}
\If{$a_i.state=explore$}
{
    \If{the current node $v$ is already visited by $a_i$}
    {
        set $a_i.prt\_out=a_i.prt\_in$ and move through $a_i.prt\_out$\\
    }
    \Else
    {
        mark the current node $v$ as visited node\\
        set $a_i.prt\_out=(a_i.prt\_in+1)\mod deg(v)$\\
        \If{$a_i.prt\_out=$ value of port used to enter into $v$ for the first time}
        {
            set $a_i.state=backtrack$ and move through $a_i.prt\_out$\\
        }
        \Else
        {
            move through $a_i.prt\_out$\\
        }
    }
}
\ElseIf{$a_i.state=backtrack$}
{
    set $a_i.prt\_out=(a_i.prt\_in+1)\mod deg(v)$\\
        \If{$a_i.prt\_out=$ value of port used to enter into $v$ for the first time}
        {
            set $a_i.state=backtrack$ and move through $a_i.prt\_out$\\
        }
        \Else
        {
            set $a_i.state=explore$ and move through $a_i.prt\_out$\\
        }
}
\end{algorithm}



In \cite{dyn_disp}, the authors achieve dispersion by dividing the group of agents into two groups when a missing edge is encountered for the first time. After that, both groups run their DFSs separately. Based on their idea, one group never deviates from its original path of DFS. Here, the original path of DFS means the path that would have been executed by the agent if there were no missing edges. The other group, on the other hand, deviates after some finite waiting period. We use a similar idea that solves 1-BHS using 4 agents when the agents have one-hop visibility. Now we proceed with a detailed description of our algorithm. 

Let $a_1, a_2, a_3,$ and $a_4$ be four agents initially positioned at a node $v_r$ of the graph. These agents are divided into two groups, $G_1$ and $G_2$. In particular, $G_1 = {a_1, a_2}$, where $a_1$ is the leader, denoted by $L_{G_1}$, and $a_2$ is the helper, denoted by $H_{G_1}$. Similarly, $G_2 = {a_3, a_4}$, where $a_3$ is the leader ($L_{G_2}$) and $a_4$ is the helper ($H_{G_2}$). Initially, both $G_1$ and $G_2$ are located at $v_r$, from which they begin their DFS traversal. Since they start from the same root, both groups compute the same outgoing port, say $p$, to proceed. However, both groups cannot simultaneously traverse through the same port, as the adjacent node may be $v_{BH}$. To address this, only $H_{G_2}$ probes the port $p$ in round $t$. In round $t+1$, by means of one-hop visibility, both $G_1$ and $L_{G_2}$ confirm whether the adjacent node is safe, if the edge corresponding to port $p$ is available. If the node is safe, then by the end of round $t+1$, $G_1$ and $L_{G_2}$ also traverse through port $p$. This type of movement is referred to as cautious movement, which is utilized in several existing works on BHS. Throughout the process, both groups update their DFS information on the whiteboard.
Now suppose that $G_1$ and $G_2$ are located at a node $u$ and must traverse through a port $p'$ corresponding to an edge that is temporarily missing. In such a case, $G_1$ waits at $u$ until the edge reappears. In contrast, $G_2$ may disregard this edge depending on the context. If both agents of $G_2$ are together and the missing edge through $p'$ is to be explored, then $G_2$ skips this edge and continues its traversal. However, if the missing edge through $p'$ is required for backtracking, then $G_2$ initiates a new DFS traversal from its current position.
Since all movements are carried out cautiously, the dynamic behavior of the edges may necessitate changes in group composition. Nevertheless, agent $a_1$ retains its fixed role as $L_{G_1}$ and never deviates from its designated DFS path. Both the groups $G_1$ and $G_2$ begin their DFS traversal cautiously. The information corresponding to the leader of each group is written on the whiteboard. The parameters maintained on the whiteboard by the groups are as follows: 
\begin{itemize}
    \item $\bm{wb_v(G_1).(parent)}$: This parameter stores the information regarding node $v$ w.r.t. the DFS traversal of the leader of $G_1$. The variable $parent$ stores the port used by the leader of the group $G_1$ to visit node $v$ for the first time. Initially, $wb_v(G_1).(parent)=-1$.
    \item $\bm{wb_v(G_2).(parent, dfs\_label)}$: It stores the information regarding node $v$ w.r.t. the DFS traversal of the leader of $G_2$. The variable $parent$ stores the port used by the leader of group $G_2$ to visit node $v$ for the first time. The variable $dfs\_label$ stores the number of DFS being run by $G_2$. Initially, $wb_v(G_2).(parent, \\dfs\_label)=(-1,1)$.
\end{itemize}

Note that the group $G_1$ does not need to maintain $dfs\_label$ as it never restarts its DFS. It runs only a single DFS, and the leader of $G_1$ always stays at its original path of its DFS. 
Initially, all the agents are at $v_r$. The leaders of both the groups write on the whiteboard $wb_v(G_1).(parent)=-1$ and $wb_v(G_2).(parent,dfs\_label)=(-1,1)$. Both groups proceed with their DFS traversal cautiously unless they encounter a missing edge. Recall that, with moving cautiously, we mean that the helper moves first through the computed port (for the DFS traversal of its respective group). If the movement by this helper is successful, the edge corresponding to this computed port is present, and the helper is alive (at the adjacent node), then the leader performs its movement through this computed port.
When a missing edge is encountered for the first time, $G_2$ will not wait for the missing edge to reappear and proceed. There are several cases, and we deal with each as follows.

\noindent \textbf{(I) Both $\bm{L_{G_1}}$ and $\bm{H_{G_1}}$ are present at a node $\bm{v}$ and have $\bm{state=explore}$}:
Let the computed $prt\_out$ value by $G_1$ be $p$. Now there are two cases: (i) the edge corresponding to port $p$ is present, or (ii) it is not present. If the edge corresponding to port $p$ is present, it does the following. If it finds only $L_{G_2}$ at node $v$, and its outgoing port is $p$, then it check whether $H_{G_2}$ is present at node corresponding to port $p$. If yes, then it moves as per the cautious movement strategy, $H_{G_1}$ moves through the port $p$. Otherwise, it detects the $p$ leads to $v_{BH}$. On the other hand, if the edge corresponding to port $p$ is not present, then the entire $G_1$ is stuck at the current node $v$. In this case, it is necessary to check whether there is any agent from $G_2$ present at the current node $v$. To check this we have the following sub-routine. This sub-routine is required several times in our algorithm to ensure that the movement of at least one of the groups is continued. 

\begin{itemize}
    \item If only $L_{G_2}$ is present at the current node $v$ and its $prt\_out$ is the same as that of $G_1$: In this case, $L_{G_1}$ updates its helper to the helper of $G_2$ and understands that it has already moved through $prt\_out$. Thus, $L_{G_1}$ now waits at the current node for the missing edge to reappear. On the other hand, $L_{G_2}$ updates its helper to the helper of $G_1$ and begins a new DFS traversal, by incrementing the $dfs\_label$, with the current node as the root node of this new DFS traversal. Particularly, the old helper of $G_1$ is the new helper of $G_2$. Both these agents now comprise $G_2$, and they proceed with their DFS traversal.
    \item If only $H_{G_2}$, is present at the current node and its $prt\_in$ is the same as the $prt\_out$ of $G_1$: In this case, $L_{G_1}$ updates its helper to the leader of $G_2$. Further, it waits at the current node for the missing edge to reappear. On the other hand, $H_{G_2}$ becomes the new leader of $G_2$ and updates its helper to the old helper of $G_1$. Now these two agents begin a new DFS traversal with the current node as the root node of this new DFS traversal.
    \item Either both the agents of $G_2$ are present at the current node or none of them are present at the current node: In this case, $G_1$ simply waits for the missing edge to re-appear.
\end{itemize}

\noindent \textbf{(II) Only $\bm{L_{G_1}}$ is present at a node $\bm{v}$ and has $\bm{state=explore}$}: Let $L_{G_1}$ be present at a node $v$ and the helper $H_{G_1}$ already moved through a port $p$ at a round say $t$. At round \( t+1 \), if the edge corresponding to port \( p \) is present and \( H_{G_1} \) is alive at the node connected to node \( v \) via port \( p \), then \( L_{G_1} \) will move through port \( p \). If not, it indicates that port \( p \) from node \( v \) leads to \( v_{BH} \). Let the edge corresponding to port $p$ go missing at the start of the round $t+1$. In this case, agent $L_{G_1}$ is stuck at node $v$ due to a missing edge. If no agent from group $G_2$ is present at the current node, then $L_{G_1}$ continues its wait for the missing edge to reappear. On the other hand, if there is at least one agent from $G_2$, then the following cases needs to be verified:
\begin{itemize}
    \item If both $L_{G_2}$ and $H_{G_2}$ are present at $v$: If $G_2$ has to move through a port other than $p$ say $p'$, then they can proceed. If $G_2$ has to move through port $p$, then they proceed in the following way. If they are in $explore$ state, then the agents of $G_2$ skip this edge and proceed further. Since both the agents of $G_2$ are present together, no change of groups is needed in this case. On the other hand, if $G_2$ has to backtrack through the edge corresponding to port $p$, then they increase their $dfs\_label$ and begin a new DFS with the current node as its root node.
    
    \item If $L_{G_2}$ is present at $v$: If $L_{G_2}$ is present at node $v$, then it is definite that the $prt\_out$ values for $L_{G_2}$ and $L_{G_1}$ are different. This is because, as per our algorithm, both $H_{G_1}$ and $H_{G_2}$ can not move through the same port if both groups are together. Suppose it were allowed. If the adjacent node was $v_{BH}$, then both $H_{G_1}$ and $H_{G_2}$ would have died in $v_{BH}$ together. Hence, the leaders of both groups would remain stuck, and neither of them could identify the location of $v_{BH}$.

    \item If $H_{G_2}$ is present at $v$: If the $prt\_in$ value of $H_{G_2}$ is the same as the $prt\_out$ value of $L_{G_1}$, this means at the adjacent node (i.e., the node adjacent to $v$ with respect to port $p$), $L_{G_2}$ and $H_{G_1}$ are present. In this case, the change of groups happens as follows. The agent $H_{G_2}$ now becomes the new helper of $G_1$. The agent $H_{G_1}$ (old) now becomes the new helper of $G_2$, and the (new) $G_2$ starts a new DFS traversal by incrementing the value of $dfs\_label$ and their current node as the root node.
\end{itemize}

\noindent \textbf{(III) Only $\bm{H_{G_1}}$ is present at a node $\bm{v}$ and has $\bm{state=explore}$}: Let $H_{G_1}$ be present at a node $v$ and has entered into the node $v$ via port $p$ at a round $t$. At round $t+1$, the edge corresponding to port $p$ disappeared, and due to which the agent $L_{G_1}$ could not enter into $v$. Now, the agent $H_{G_1}$ needs to check if any agent from group $G_2$ is present at the current node. Based on this, the following cases arise:
\begin{itemize}
    \item If both $L_{G_2}$ and $H_{G_2}$ are present at $v$: Since both the agents of $G_2$ are together, group change is not required in this case. If they have to move through the edge corresponding to port $p$ in the $explore$ state, then $G_2$ can skip the edge and proceed further as per its DFS. Otherwise, if $G_2$ has to backtrack via that edge, then it restarts a new DFS traversal from $v$ by incrementing its value of $dfs\_label$. $H_{G_1}$ does not do anything in this case.

    \item If $L_{G_2}$ is present at $v$ and $prt\_out$ value of $L_{G_2}$ is equal to $p$: This means $H_{G_2}$ and $L_{G_1}$ are present at the other end of the missing edge. In this case, $L_{G_2}$ updates its helper to $H_{G_1}$ and begins a new DFS traversal from the current node.

    \item If $H_{G_2}$ is present at $v$: If $H_{G_2}$ is present at $v$ then it is definite that the $prt\_in$ values of $H_{G_1}$ and $H_{G_2}$ are different. This is because if the $prt\_in$ values of both $H_{G_1}$ and $H_{G_2}$ are the same, then they moved through the same port at the same round. However, as per our algorithm, we do not allow this. To see why this restriction is necessary, suppose it were allowed. Let the edge corresponding to port $p$ lead to $v_{BH}$. Then both $H_{G_1}$ and $H_{G_2}$ would enter node $v_{BH}$ together and die. Moreover, since the adversary could subsequently delete the edge corresponding to port $p$, neither $L_{G_1}$ nor $L_{G_2}$ would ever be able to detect node $v_{BH}$.
\end{itemize}
 
These are all the cases that may occur while performing cautious movement, due to which group exchange may occur. Note that if the state of $G_1$ or $G_2$ is $backtrack$, then they do not have to move cautiously, as the node where agents reach after $backtrack$ has already been explored. Now, let us suppose $G_1$ is at a node $u$ and it has to backtrack via port $p$ that corresponds to edge $(u,v)$. The edge $(u,v)$ is missing. We have the following three cases based on the presence of $G_2$ at $u$.
\begin{itemize}
    \item If only $H_{G_2}$ is present at $u$: If $prt\_in$ value of $H_{G_2}$ is the same as the $prt\_out$ value of $G_1$, then a change of groups is needed in this case. Here, $H_{G_2}$ becomes the leader of $G_2$ and $H_{G_1}$ becomes the helper of $G_2$. The newly formed $G_2$ continues its DFS traversal further. The agent $L_{G_1}$, on the other hand, updates its new helper to (old) $L_{G_2}$. 
    \item If only $L_{G_2}$ is present at $u$: If $prt\_out$ value of $L_{G_2}$ is the same as the $prt\_out$ value of $G_1$, then a group change is required. Agent $L_{G_2}$ updates its new helper to $H_{G_1}$, and this newly formed $G_2$ starts a new DFS traversal from the current node $u$. Agent $L_{G_1}$ updates its (new) helper to (old) $H_{G_2}$.
    \item If both $L_{G_2}$ and $H_{G_2}$ are present at $u$: If both the agents of $G_2$ are together, then no change of groups is required. If they have to explore via edge $(u,v)$, then $G_2$ skips this edge and continues further. Otherwise, if $G_2$ has to backtrack via edge $(u,v)$, then it restarts a new DFS traversal from $u$.
\end{itemize}



\subsection{Correctness and analysis of the algorithm}
In this section, we first show that one of the groups explores $G$. To show this, we consider first that each group contains only one agent, and there is no black hole in $G$. Let $G_1$ and $G_2$ be two groups, and they are running the $DFS$ algorithm. 


Initially, $G_1$ and $G_2$ are at the same node and start executing the $DFS$ algorithm. Whenever they encounter the missing edge for the first time, $G_1$ remains on the same path of $DFS$, and $G_2$ starts a new $DFS$ algorithm. At a whiteboard, there are two information. One is corresponding $G_1$ i.e., $wb_v(G_1).(parent)$, and other one is corresponding $G_2$ i.e, $wb_v(G_2).(parent,\, dfs\_label)$. With the help of $dfs\_label$, $G_2$ can recognize whether the information at the node corresponds to old $DFS$ or current $DFS$. Let in round $r<4m$, $G_1$ be at node $w$ and want to go through edge $e=(w\, \,w')$. At the round $r$, if the adversary removes an edge $e$ at round $r$, then as per our algorithm, $G_1$ waits for the edge $e$, and $G_2$ starts the new $DFS$ from node $w$. At node $w$, $wb_w(G_2).(parent,\, dfs\_label)=(-1,\,1)$. We have the following claim.
 



\begin{myclaim}\label{claim:G_1}
     Let in round $r'$, $r\leq r'<4m$, $G_1$ be at node $u$ and want to go through edge $e'=(u\, \,v)$. At the round $r'$, if the adversary removes an edge $e'$, and edge $e'$ does not appear within the next $8m$ rounds after it is deleted by the adversary in round $r'$, then $G_2$ visits every node of $G$ in $8m$ rounds. 
\end{myclaim}
\begin{proof}
   Suppose at round \( r' \), \( G_2 \) is at node \( u' \). Within the next $4m$ rounds, one of two things is possible: \( G_2 \) visits every node of $G$, or \( G_2 \) reaches the root of the current DFS. It is due to the fact that between rounds $r'$ and $r'+4m$ \( 4m \), $G_2$ either visits every node of $G$, starts a new DFS from some node $w$ (it is possible when it want to go through edge $e$ in $backtrack$ state), or reaches the root, say $v_r$, of the current DFS traversal of $G_2$. In both cases, it explores $G\setminus \{e'\}$ as if it tries to via edge $e'$ from node $u$ (resp node $v$), it skips it. Therefore, if edge $e'$ does not appear again, then $G_2$ visits each node at least once. This completes the proof.
\end{proof}



% \begin{proof}
%     Let $a_1\in G_1$, and $a_2\in G_2$. At the round $r'\geq r$, $a_2.state$ is either $explore$ or $backtrack$. At round $r'$, let $x$ be the root node of the current DFS of agent $\mathcal{A}_2$. At round $r''(\geq r')$, there are three cases: (i) $a_2$ tries to move edge $e'=(v, u)$ from node $v$, or (ii) $a_2$ tries to move edge $e'=(u, v)$ from node $u$, or (iii) $a_2$ reaches node $x$.

%     \begin{itemize}
%         \item \textbf{Case (i):} According to our algorithm, agent \( a_2 \) restarts its depth-first search (DFS) by writing at node \( v \): \( wb_v(G_2).(parent, \, dfs\_label) = (-1, \, a_2.dfs\_label + 1) \). It also updates \( a_2.dfs\_label \) to \( a_2.dfs\_label + 1 \). In this scenario, if edge \( e' \) does not reappear within the next \( 4m \) rounds, agent \( a_2 \) attempts to move along edge \( e' \) from node \( u \). However, since agent \( a_1 \) is present at node \( u \), agent \( a_2 \) skips edge \( e' \) and proceeds to use the next available port, or it backtracks if there are no other ports to explore. As a result, within \( 4m \) rounds, agent \( a_2 \) explores the graph \( G - \{e\} \).

%         \item \textbf{Case (ii):} In this case, it restarts its new DFS from node $x$ by updating $wb_x(G_2).(parent,\, dfs\_label)=(-1,\,dfs\_label+1)$. As per our algorithm, it skips edge $e'=(u, v)$ if it reaches node $u$ and tries to move via edge $e'$. Therefore, within the next $4m$ rounds, agent $a_2$ reaches node $v$ and tries to move through edge $e'=(v,u)$. This is nothing but Case (i).
        
%         \item \textbf{Case (iii):} As per algorithm in Case (iii), agent \( a_2 \) skips edge \( e' \) and proceeds to use the next available port, or it backtracks if there are no other ports to explore. In this way, either it reaches node $v$ or $x$. If it reaches node $v$, it is nothing but Case (i). If it reaches node $x$, it is nothing but Case (ii).
%     \end{itemize}

%     If agent \( a_2 \) finds itself in Case (i), it will explore the graph \( G - \{e'\} \) within the next \( 4m \) rounds. And, if agent \( a_2 \) is in Cases (ii) or (iii), it will transition to Case (i) within the next \( 8m \) rounds. In round \( r' \), where \( r \leq r' < 4m \), let \( G_1 \) be at node \( u \) and intending to traverse the edge \( e' = (u, v) \). If the adversary removes the edge \( e' \) at round \( r' \), and \( e' \) does not reappear in the following \( 12m \) rounds after its removal, then \( G_2 \) will successfully explore \( G \) within \( 12m \) rounds. This completes the proof.
% \end{proof}


\begin{lemma}\label{lm:correctness}
    Either $G_1$ or $G_2$ visits every node of $G$ correctly in $O(m^2)$ rounds. 
\end{lemma}
\begin{proof}
 If agent \( G_1 \) does not find any missing edges during the execution of DFS, it successfully explores graph \( G \) in the first $4m$ rounds. Suppose agent \( G_1 \) is at node $u$ at round $r'$, and wants to move via edge \( e'=(u,v) \) but edge $e'$ is missing. Due to Claim \ref{claim:G_1}, if edge $e'$ does not appear again between rounds $r'$ and $r'+4m$, then $G_2$ visits each node of $G$ at least once. If edge $e'$ appears, then $G_1$ is able to execute its current DFS for at least one round. This can happen at each DFS step of $G_1$. Therefore, within the first $8 m\times 4m=32m^2=O(m^2)$ rounds, either $G_1$ or $G_2$ visits each node of $G$ at least once. This completes the proof. \qed
\end{proof}

Consider $G_1$ and $G_2$, which contain two agents, respectively, and there is a node $v_{BH}$ in $G$. Before providing the final theorem, we have the following remark. 

\begin{remark}
    In our algorithm, we describe a procedure by which groups of agents change their roles. This role change is essential; without it, both groups would get stuck, and the problem could not be solved. The underlying idea is that at least one of the groups must successfully complete a CCM cycle.
\end{remark}


\begin{theorem}\label{thm:1-hop}
    The problem of $1$-BHS can be solved by 4 agents starting from a rooted initial configuration in $O(|E|^2)$ rounds when agents are equipped with 1-hop visibility and $O(\log n)$ memory, and $O(\log n)$ storage per node is present. 
\end{theorem}
\begin{proof}
    Initially, $4$ agents are divided into two groups, namely $G_1$ and $G_2$, each comprising two agents. The movement performed by the agents in the exploration is replicated by each group of two agents that perform a cautious walk. Therefore, one round of the exploration strategy is replicated by two rounds (may not be contiguous) in which the agents perform a cautious walk.

    In Lemma \ref{lm:correctness}, we have shown that within the first $32m^2$ rounds, either $G_1$ or $G_2$ visits every node $G$. As per the movement strategy for exploration, the agents move only in every round, so with $2$ rounds, at least one group would do its movement as per our exploration strategy. For a group $G_1 (\text{or }G_2)$ that has two agents, if one agent (say $a_1$) visits node $v_{BH}$ in a cautious manner and the other (say $a_2$) does not find $a_1$ in the neighbour using 1-hop visibility, agent $a_2$ finds node $v_{BH}$. Hence, using Lemma \ref{lm:correctness}, the time complexity of our algorithm to solve $1$-BHS is $O(m^2)$ when agents are equipped with 1-hop visibility.

   Agent $a_i$ remembers the IDs of other agents (such as $a_i.leader$, $a_i.helper$). Since the number of agents is finite, this takes $O(\log n)$ memory. Agents also store port information (such as $a_i.prt\_in$, $a_i.prt\_out$), which fits in $O(\log n)$ memory. Other parameters like $a_i.state$ and $a_i.flag$ require only $O(1)$ memory. Since 1-BHS is achieved by all agents in $O(m^2) = O(n^4)$ rounds (as $m \leq n^2$). So the value of $a_i.dfs\_label$ never exceeds $O(n^4)$ and can also be stored in $O(\log n)$ memory. Thus, each agent uses only $O(\log n)$ memory in every round. At every node $v$, we store $wb_v(G_1).(parent)$ and $wb_v(G_2).(parent,dfs\_label)$ which can be done in $O(\log n)$ storage as $parent$ is nothing but port information, and $dfs\_label$ never exceeds $O(n^4)$. This completes the proof. \qed
\end{proof}


\section{Algorithm using global communication}
In this section, we provide an algorithm that solves the problem of 1-BHS using $\delta_{BH}+2$ many agents that are arbitrarily positioned at the nodes of the graph initially, and agents are equipped with global communication and 0-hop visibility.

Our technique to solve BHS, in this case, is to first provide an exploration technique and then replace the exploration steps with cautious movement to prevent all the agents from entering into node $v_{BH}$. The exploration technique ensures that each node of the graph is visited by at least one agent. The cautious movement by the agents ensures the safe movement by the agents, i.e., to ensure that all the agents do not end up entering node $v_{BH}$. However, the implementation of this idea is non-trivial since all the agents are arbitrarily positioned in the initial configuration. To address this challenge, we first introduce a cautious movement strategy that can be executed by an agent even when it operates independently.   

\medskip
\noindent\textbf{Cautious movement $\bm{1}$ ($\bm{CM_1}$)}: Let an agent $a_i$ be positioned at node $v$ during round $t$. It computes the port $p_i$ through which it intends to exit $v$ and writes this information, along with its unique ID, on the whiteboard. At the end of round $t$, it attempts to traverse through port $p_i$. If the movement is successful (at some round $t' \geq t$), it reaches the adjacent node $v'$. Upon arrival at $v'$, if $a_i$ verifies that $v'$ is not node $v_{BH}$ (i.e., if it survives upon reaching $v'$), it returns to node $v$, deletes the previously written information about $p_i$ and its ID, and safely moves through $p_i$ to finally reach $v'$. However, if $v'$ is node $v_{BH}$ (i.e., $a_i$ is destroyed), then the information is left intact at $v$. Any subsequent agent, say $a_j$, arriving at $v$ can observe this information and deduce that port $p_i$ leads to node $v_{BH}$. This deduction is possible because the agent, upon performing global communication, will detect that no agent with ID $a_i.ID$ is present in the graph. Hence, $a_i$ has died in node $v_{BH}$. This strategy ensures that not all agents enter node $v_{BH}$, and the location of node $v_{BH}$ is determined. 

\medskip
\noindent{\textbf{The algorithm:}} As per Section \ref{sec:onehop}, it is clear that two agents can explore the graph if we initially assume that there is no black hole in the graph. We begin by briefly describing the idea of the exploration strategy of two agents.

% \noindent \underline{Exploration strategy using 3 agents} \cite{BHS_gen}- The exploration strategy using three agents in \cite{BHS_gen} uses only face-to-face communication by the agents. Furthermore, the assumption is $O(\log n)$ memory by each agent and $O(\log n)$ bits of storage at each node in the form of whiteboard. We now begin with the idea of their strategy. Let $A_1, A_2, A_3$ be the three agents that are initially positioned arbitrarily at the nodes of the graph $G$. Let $A_1.ID<A_2.ID<A_3.ID$. All three agents begin with their individual DFSs from their current nodes as their root nodes. These agents continue their DFSs unless a missing edge is encountered. The agent $A_1$ never deviates from the original path of its DFS. If it wants to move through a port and the edge corresponding to that port is missing, then it continues its attempt to move through that port unless it is successful in doing so. Now, due to a missing edge, at most 2 agents can be blocked. When two agents are present at the same node and both want to move through the same edge, and that edge is missing, then the agent with a larger ID skips that edge and continues its DFS further. While the smaller ID agent continues its attempt to move through the same edge. In this way, $A_1$ never deviates from the original path of its DFS as it is the agent with the smallest ID. This also ensures that at least one of the three agents makes a move, and hence the exploration is ensured.


\noindent \underline{Exploration strategy using 2 agents}- This strategy works when two agents $A_1$ and $A_2$ are initially present at the same node in the graph $G$. Without loss of generality, assume that $A_1.ID<A_2.ID$. Both agents begin their movement as per their DFS. The idea is that $A_2$ is never stuck at any node due to a missing edge. When a missing edge is encountered, $A_1$ stays at its node and attempts to move through the same edge unless it is successful in doing so. On the other hand, $A_2$ skips the missing edge if it has to traverse that edge in $explore$ state as per its DFS, or it starts a new DFS if it has to traverse that edge in $backtrack$ state, or it has reached the root node with no further edges left to be explored. In this way, either $A_1$ explores the whole graph. Or if it is stuck at a node attempting to traverse through an edge $e$ for sufficient time then $A_2$ traverses the graph $G\setminus\{e\}$.

Since, in our model, the agents have global communication, this exploration strategy can be implemented even when the agents are initially arbitrarily positioned at the nodes of the graph. We use these ideas in our algorithm and show that the power of global communication can further help the agents to detect the location of node $v_{BH}$. Let $\{a_1, a_2, a_3, \ldots, a_{\delta_{BH}+2}\}$ be the agents that are initially present arbitrarily at the nodes of $G$. Since the agents have the facility of global communication, the first two smallest ID agents begin with the run of the exploration strategy of using two agents by replacing each edge movement with $CM_1$ with a little bit of modification. At a node \( v \), if an agent \( a_i \) wants to initiate movement according to \( CM_1 \), it first checks for any information regarding another agent \( a_j \) at node \( v \). If such information exists, the agent then verifies whether \( a_j \) is alive. If \( a_j \) is alive, \( a_i \) proceeds with \( CM_1 \). However, if \( a_j \) is not alive, \( a_i \) determines which port from node \( v \) leads to \( v_{BH} \). If no information related to \( CM_1 \) from any other agent is available, \( a_i \) will proceed with its own \( CM_1 \). In particular, agent $a_1$ executes like $A_1$, and agent $a_2$ executes like $A_2$. The remaining agents stay at their own nodes. Agent $a_1$ has a smaller ID; thus, it never skips the edge or starts a new DFS traversal whenever a missing edge is encountered. Agent $a_2$ can deviate as per the exploration technique using two agents. During this traversal, five cases arise:


    \noindent \underline{Case 1}- It may happen that while performing $CM_1$, agent $a_1$ dies into node $v_{BH}$. In this case, the remaining agents can understand this scenario using global communication, and thus the next minimum ID agent from the group of agents not performing the algorithm currently (i.e., $a_3$) begins its DFS traversal via $CM_1$. The agent $a_3$ acts similarly to $A_1$ (as given in the exploration strategy using 2 agents), i.e., it never deviates from its original path of its DFS traversal.
    
    \noindent \underline{Case 2}- If agent $a_2$ dies into node $v_{BH}$, and $a_1$ is still alive, then $a_3$ begins its DFS traversal via $CM_1$. The agent $a_3$ in this case acts similarly to $A_2$, i.e., it may deviate from its original path of its DFS traversal.

    \noindent \underline{Case 3}- It may happen that both $a_1$ and $a_2$ die into node $v_{BH}$. In this case, $a_3$ and $a_4$ begin the traversal of the graph. Agent $a_3$ performs similarly to $A_1$, and $a_4$ performs similarly to $A_2$. 
    
    \noindent \underline{Case 4}- Let both the agents $a_1$ and $a_2$ be stuck on the opposite sides of a missing edge, say $(u,v)$. Let $a_1$ be present at node $u$ and $a_2$ be present at node $v$. Note that this scenario is possible only when $a_1$ has written its information at $v$ and moved to $u$ during its execution of $CM_1$. Similarly, $a_2$ has written its information at $u$ and moved to $v$ during its execution of $CM_1$. And both these agents want to return to their previous nodes in order to delete their respective information. They fail to do so due to the missing edge $(u,v)$. In this case, $a_1$ deletes the port information written at $u$ by $a_2$, and $a_2$ deletes the port information written at $v$ by $a_1$, and both agents proceed further as per their DFS.

    \noindent \underline{Case 5}- If agents $a_1$ and $a_2$, attempt to move through the same port $p$, they do not traverse it simultaneously. The agent with the smaller identifier (say $a_1$) proceeds through port $p$. If $a_1$ successfully moves via port $p$, then in the next round, $a_2$ verifies the status of $a_1$ via global communication. If $a_1$ is confirmed to be alive, then $a_2$ also traverses port $p$. Otherwise, $a_2$ understands that port $p$ leads to $v_{BH}$.


Note that we have provided the above cases with reference to only the functioning of agents $a_1$, $a_2$, and $a_3$. However, this process continues unless node $v_{BH}$ is found, which is determined if one of the agents reaches a node where there is information corresponding to the $CM_1$ of an agent which has moved to node $v_{BH}$. This is easy to determine if the agent whose information is written is alive or not via global communication. In other words, when the agents run their algorithm one by one, it is ensured that at least one agent is performing its movement and is not stuck at a node due to a missing edge. With this, it is definite that an agent either enters into node $v_{BH}$ or reaches a node where there is already information written corresponding to an agent that has died in node $v_{BH}$. In the latter case, the node $v_{BH}$ is found. In the former case, we get a marked node, i.e., a node where information is written corresponding to an agent that has died in node $v_{BH}$. Now, in the worst case, at most $\delta_{BH}$ agents can die in node $v_{BH}$. Hence, two agents are left that run the exploration strategy using 2 agents. This strategy ensures that at least one of the two agents definitely reaches one of the neighbouring nodes of node $v_{BH}$ and thus the node $v_{BH}$ is determined in this scenario. This completes our algorithm.
\subsection{Correctness and analysis of the algorithm}
In this section, we provide the correctness and the complexity analysis of our algorithm. As per our algorithm, two agents, say $a_1$, $a_2$, are executing the algorithm as mentioned in Section \ref{sec:onehop} using CM$_1$. Therefore, we can use Lemma \ref{lm:correctness} to show that either $a_1$ or $a_2$ visits every node in $O(m^2)$ rounds. Due to page constraints, we skip repeating the same analysis. Based on Lemma \ref{lm:correctness}, we have the following lemma, which we use to show the correctness of our algorithm. 
\begin{lemma}\label{lm:corr}
    If agents $a_i$ or $a_j$ are moving as per the exploration strategy using $CM_1$, then either $a_i$ or $a_j$ visits every node of $G$ in $O(m^2)$ rounds.
\end{lemma}
\begin{proof}
    The proof is similar to Lemma \ref{lm:correctness}.
\end{proof}
\begin{theorem}\label{thm:global}
    The problem of $1$-BHS can be solved by $\delta_{BH}+2$ agents starting from an arbitrary initial configuration in $O(\delta_{BH}\cdot |E|^2)$ rounds, when agents are equipped with global communication, $O(\log n)$ memory, and each node has $O(\log n)$ storage. 
\end{theorem}

\begin{proof}
    Consider $\delta_{BH}+2$ agents $a_1, a_2, \ldots, a_{\delta_{BH}+2}$ placed arbitrarily at the start. The two smallest ID agents, $a_1$ and $a_2$, begin the exploration strategy using 2 agents, while the rest remain idle. By Lemma~\ref{lm:corr}, at least one of $a_1$ or $a_2$ visits every node of $G$ within $O(m^2)$ rounds; since $v_{BH}$ is among these nodes, at least one of them must eventually die at $v_{BH}$. The remaining agents detect this through global communication and let the two smallest ID survivors take over the roles of $a_1$ and $a_2$. This process repeats: in each $O(m^2)$ round phase, at most one agent dies at $v_{BH}$ while the other explores the graph and leaves information about the port which leads to $v_{BH}$ while doing $CM_1$. Because node storage persists and agents can check the validity of stored information through global communication, the system consistently accumulates correct knowledge of which ports lead to $v_{BH}$.  

    At most $\delta_{BH}$ agents die in $v_{BH}$. Once this happens, all neighbors of $v_{BH}$ have correct information pointing to which port leads to $v_{BH}$. One of the two surviving agents then explores the graph, reaches a neighbor of $v_{BH}$, and learns the port information which leads to $v_{BH}$, thereby solving the problem. Since each phase takes $O(m^2)$ rounds and there can be at most $\delta_{BH}$ deaths, the total running time is $O(\delta_{BH}\cdot m^2)$. At every node, storing the IDs of the two currently active agents along with the $CM_1$ information requires $O(\log n)$ space. By Theorem~\ref{thm:1-hop}, the exploration itself requires $O(\log n)$ memory, and remembering the IDs of the two active agents also fits in $O(\log n)$. Thus, the memory requirement per agent is $O(\log n)$. This completes the proof. \qed
\end{proof}
\section{Conclusion}
In this work, we investigated the 1-BHS problem in dynamic graphs under different agent capabilities and initial configurations. We proved two impossibility results: three agents are insufficient to solve the problem even under strong assumptions, and $\delta_{BH}+2$ agents cannot succeed when starting from a scattered configuration. On the positive side, we designed algorithms that match these lower bounds under enhanced agent capabilities. Specifically, we showed that four agents with 1-hop visibility and logarithmic memory suffice from a rooted configuration, and that $\delta_{BH}+2$ agents with global communication and logarithmic memory suffice from any configuration. Together, these results clarify the role of communication and visibility in BHS and provide tight bounds for the number of agents required. 

\bibliographystyle{unsrt}
\bibliography{Bib.bib}
\end{document}




