# Edge and Cloud Computing in Smart Cities
## 2 Architectural Models for Edge and Cloud Computing in Smart Cities
### Fully Distributed Edge-Cloud Architecture  
The fully distributed edge-cloud architecture eliminates the constraints of hierarchical computing models by enabling decentralized processing, decision-making, and coordination among edge nodes and cloud resources. In contrast to traditional architectures where task execution follows a predefined hierarchy, this model ensures dynamic workload distribution across edge nodes, reducing bottlenecks and improving scalability and fault tolerance [28; 29]. A fully distributed edge-cloud system can be represented by an undirected graph \(G(\mathcal{N},\mathcal{L})\) where \(\mathcal{N}=E\cup\text{C}\) is the set of computational nodes, consisting of edge nodes \(E\) and cloud nodes \(C\). The set \(\mathcal{L}\) represents bidirectional communication links between these nodes, enabling distributed decision-making and resource sharing [30; 31]. Unlike hierarchical models where cloud resources predominantly determine task execution, the distributed model allows edge nodes to autonomously decide whether to process a task locally or offload it to a neighboring node or cloud resource. For each task \(\tau\) arriving at edge node \(E_{j}\in E\), the execution decision is determined based on the following latency-aware rules function \[F(\tau)= \begin{cases}E_{j},&\text{if }T_{E_{j}}\leq T_{C}\text{ and }T_{E_{j}}\leq T_{E_{k}}+T_{\text{comm}}(E_{j},E_{k}),\\ E_{k},&\text{if }T_{E_{k}}+T_{\text{comm}}(E_{j},E_{k})\leq T_{E_{j}}\text{ and }T_{E_{k}}+T_{\text{comm}}(E_{j},E_{k})\leq T_{C},\\ C,&\text{otherwise}.\end{cases}  \tag{10}\]  
where \(T_{E_{j}}\), \(T_{E_{k}}\) is the task execution time at edge node \(E_{j}\) and \(E_{k}\), respectively, \(T_{C}\) is the execution time at the cloud, and in case of task offloading to a neighboring node, \(T_{\text{comm}}(E_{j},E_{k})\) denotes the communication delay between nodes \(j\) and \(k\). This decision function aims to minimize execution latency while accounting for network constraints and computational limitations [32; 33]. The function prioritizes local execution at \(E_{j}\) if it offers the lowest latency. If a neighboring edge node \(E_{k}\) executes the task faster than \(E_{j}\) and the cloud, the task is migrated to \(E_{k}\). If neither local execution nor edge-to-edge migration is feasible, the task is offloaded to the cloud. Each edge node has finite computational capacity \(C_{E_{j}}\) and energy budget \(E_{E_{j}}^{budget}\). The workload assigned to an edge node at any time is constrained by  
\[\sum_{\tau\in\mathcal{T}_{E_{j}}}C_{\tau}\leq C_{E_{j}},\sum_{\tau\in\mathcal{T }_{E_{j}}}E_{\tau}^{cons}\leq E_{E_{j}}^{budget},\quad\forall E_{j}\in E, \tag{11}\]  
where \(\mathcal{T}_{E_{j}}\) represents the set of tasks assigned to node \(E_{j}\) (which is a subset of the total tasks \(\mathcal{T}\)), and \(C_{\tau}\) and \(E_{\tau}^{cons}\) denote the computational demand and energy consumption of task \(\tau\), respectively [34; 35]. In the distributed model, edge nodes collaborate dynamically to balance workload distribution. The probability of task offloading from one edge node to another is governed by  
\[P_{\text{offload}}(E_{j}\to E_{k})=\frac{1}{1+e^{-\lambda(\theta_{k}-\theta_{ j})}}, \tag{12}\]  
where \(\theta_{j}\) and \(\theta_{k}\) denote the available computational capacity of nodes \(E_{j}\) and \(E_{k}\), respectively, and \(\lambda\) is a sensitivity parameter controlling the offloading decision. If an edge node's available capacity falls below a threshold \(\theta\)th, it attempts to offload tasks to neighboring nodes before considering cloud offloading [36; 37].