15  Network Topologies: Labs and Design

In 60 Seconds

This chapter covers practical network topology design skills: drawing professional logical and physical diagrams, planning Wi-Fi star deployments with access point placement, configuring Zigbee/Thread mesh networks, and documenting installations with floor plans and cable runs. You will learn to use tools like draw.io and Packet Tracer, and design topologies that scale for future IoT device additions.

15.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Construct Network Diagrams: Produce logical and physical topology diagrams using industry-standard tools
  • Design Star Networks: Plan Wi-Fi-based IoT deployments with optimal access point placement
  • Configure Mesh Topologies: Set up self-healing mesh networks using Zigbee or Thread protocols
  • Document Installations: Create professional network documentation including floor plans and cable schedules
  • Evaluate Diagramming Tools: Compare Visio, draw.io, Packet Tracer, and other tools for fitness to purpose
  • Plan for Scalability: Architect topologies that accommodate projected IoT device growth

Deep Dives:

Design Process:

Routing:

Architecture:

IoT Protocols:

Learning:

15.2 Prerequisites

Before diving into this chapter, you should be familiar with:

  • Network Topologies: Fundamentals: Understanding basic topology types (star, mesh, ring, bus) and the difference between physical and logical topologies is essential for creating professional network diagrams and documentation
  • Networking Basics: Knowledge of network devices, cabling standards, and wireless protocols provides the foundation for planning physical installations and cable runs
  • Layered Network Models: Understanding how protocols operate at different layers helps you design logical topologies that accurately represent data flow and network operation

15.3 🌱 Getting Started (For Beginners)

In the fundamentals chapter you learned the names and properties of star, mesh, ring, and bus topologies. This lab chapter is about drawing and documenting real networks using those ideas.

  • If you have access to tools like draw.io, Packet Tracer, or Visio:
    • Recreate the example diagrams, then redraw your own home or lab network using the same symbols.
    • Focus on clearly labelling devices, links, and subnets rather than perfection.
  • If you only have pen and paper:
    • Sketch logical diagrams first (who talks to whom), then add physical details (where devices sit on a floor plan).

Checklist for a beginner‑friendly topology diagram:

Item Question to ask yourself
Devices Did I include all gateways, switches, and APs?
Links Are all links drawn and labelled (Ethernet, Wi-Fi)?
Addresses Did I show subnets or VLANs where they matter?
Legend Did I include a small legend explaining symbols?

If you feel rusty on the difference between physical and logical topologies, review Topologies Fundamentals first, then return here and treat the labs as a guided drawing exercise.

15.4 Drawing Network Topologies

⏱️ ~15 min | ⭐⭐ Intermediate | 📋 P07.C28.U01

Comparison of network diagram types showing logical topology (abstract representation of devices and connections with symbols and labels) versus physical topology (floor-plan-based layout showing actual device locations, cable routes, and physical distances)
Figure 15.1: Types of visual representation in network diagrams - logical vs physical layouts

15.4.1 Logical Topology Drawing

Tools:

  • Hand-drawn: Quick for informal design, brainstorming
  • CAD software: Professional, consistent, standardized
    • Microsoft Visio
    • Cisco Packet Tracer
    • draw.io (free, web-based)
    • Lucidchart

Example: ARPANET c.1970 (hand-drawn)

The original internet topology map was hand-drawn on paper:

  • Nodes represented as labeled circles
  • Lines showed direct leased-line connections between sites
  • No standard symbols — informal but effective for early network planning

Modern best practices:

  • Use consistent industry-standard symbols (Cisco icons, or draw.io shape libraries)
  • Label all devices and interfaces
  • Include IP addressing information
  • Show logical groupings (VLANs, subnets)
  • Indicate key protocols used

15.4.2 Physical Topology Drawing

Requirements:

  • Building floor plans or site maps
  • Device location information
  • Cable pathway constraints
  • Wireless propagation characteristics

Process:

  1. Import floor plan (to scale)
  2. Mark device locations
  3. Plan cable routes (avoiding obstacles)
  4. Calculate cable lengths
  5. Show wireless coverage (for Wi-Fi/LoRa)
  6. Document wall materials (for RF planning)
Physical network topology diagram showing device placement with annotated distance measurements between nodes, cable runs labeled with lengths in meters, and a scale bar for spatial reference
Figure 15.2: Sample physical topology with distance measurements
Office floor plan showing physical network topology with workstations, switches, and access points positioned in rooms and corridors, cable routes drawn along walls, and network equipment labeled with device identifiers
Figure 15.3: Sample physical topology on office floorplan
Step-by-step physical topology design workflow showing the progression from importing a floor plan, placing devices, planning cable routes, to finalizing coverage zones and documentation
Figure 15.4: Sample physical topology design process
Wireless coverage planning diagram showing access point placement on a floor plan with overlapping circular coverage zones, signal strength heat map, and dead zone identification using Cisco Wireless Control System
Figure 15.5: Wireless network coverage planning with Cisco WCS
Professional physical topology documentation showing a complete network diagram with device inventory table, cable schedule, legend of symbols, IP addressing notes, and installation notes for a multi-room deployment
Figure 15.6: Physical topology documentation example

Specialized software:

  • Cisco Prime Infrastructure - Wireless planning
  • Ekahau - Wi-Fi site surveys and design
  • AutoCAD - Detailed construction plans
  • SketchUp - 3D visualization

15.5 IoT-Specific Topology Considerations

⏱️ ~12 min | ⭐⭐ Intermediate | 📋 P07.C28.U02

Three-tier hierarchical network design model with the Access layer at the bottom (IoT devices and end nodes), Distribution layer in the middle (aggregation switches and gateways), and Core layer at the top (backbone infrastructure and internet uplink), with arrows showing data flow upward through each tier
Figure 15.7: Hierarchical network design model showing access, distribution, and core layers

15.5.1 Unique IoT Challenges

1. Massive Device Count

Traditional network: 100-1000 devices IoT network: 10,000+ devices possible

Solution:

  • Multiple topology diagrams (by type)
  • Tabular device listings
  • Hierarchical grouping

2. Heterogeneous Devices

Different device types require different symbols:

Smart home star topology diagram showing a central gateway hub connected to heterogeneous IoT devices including temperature sensors, smart bulbs, motion detectors, and a smart TV, each represented with distinct icons to illustrate the need for device-specific symbols in IoT network diagrams
Figure 15.8: Smart Home Star Topology with Central Gateway
Side-by-side comparison of Star vs Mesh topology failure modes. Star topology shows Gateway as Single Point of Failure (SPOF) in red, with three sensors connected. Gateway failure causes 100% outage. Mesh topology shows four interconnected nodes with multiple paths between them in teal. One node failure causes 0% outage due to redundant paths allowing traffic rerouting.
Figure 15.9: Star vs Mesh Topology Failure Modes

This comparison illustrates the key trade-off in topology selection: a star topology’s central gateway is a Single Point of Failure (SPOF) — if it fails, all devices go offline. In a mesh topology, redundant paths allow traffic to reroute automatically when any single node fails.

Recommendation: Create symbol legend for each topology

3. Multiple Network Types

IoT systems often use multiple protocols simultaneously:

Multi-protocol smart home network diagram showing three overlapping sub-networks: a Wi-Fi network (blue) connecting cameras and thermostats to the router, a Zigbee network (green) connecting smart lights and door sensors to a Zigbee hub, and a BLE network (purple) connecting wearables and speakers, all converging on a central home gateway
Figure 15.10: Multi-Protocol Smart Home with Wi-Fi, Zigbee, and BLE Networks

Solution: Separate topologies by protocol, or use color coding

4. Wireless-Dominant

Many IoT devices are wireless:

  • Battery-powered sensors (no wires)
  • Mobile assets (vehicles, wearables)
  • Distributed outdoor sensors

Physical topology must show:

  • Gateway placement for coverage
  • Dead zones and interference
  • Redundant coverage areas

15.5.2 Example: Smart Building IoT Topology

Logical topology might separate:

  1. HVAC sensors and actuators
    • Temperature sensors (Wi-Fi)
    • Humidity sensors (Wi-Fi)
    • Damper actuators (BACnet)
  2. Security and access control
    • IP cameras (PoE Ethernet)
    • Door locks (Zigbee)
    • Motion sensors (Zigbee)
  3. Lighting and energy
    • Smart lights (Zigbee mesh)
    • Power meters (Modbus TCP)
    • Solar inverters (proprietary)

Each system gets its own topology diagram for clarity.


15.6 Topology Selection for IoT

⏱️ ~10 min | ⭐⭐ Intermediate | 📋 P07.C28.U03

15.6.1 Decision Matrix

Topology Best For Avoid When
Star Centralized control, small-medium networks Need redundancy, gateway is bottleneck
Extended Star Large buildings, campus networks Simple deployments (overkill)
Bus Short-distance, low-cost (I2C, CAN) Need high reliability
Ring Predictable performance, industrial Need flexibility, easy reconfiguration
Full Mesh Critical systems, maximum uptime Cost-sensitive, many devices
Partial Mesh Balance cost/redundancy Very simple or very critical systems

15.6.2 IoT Application Examples

Smart Home:

  • Primary: Star topology (all sensors → hub)
  • Backup: Partial mesh (Zigbee for lighting)
  • Rationale: Central control, easy management

Industrial Monitoring:

  • Primary: Extended star (multiple PLCs → SCADA)
  • Secondary: Ring (fiber backbone for redundancy)
  • Rationale: Scalable, fault-tolerant

Smart Agriculture:

  • Primary: Star-of-stars (LoRaWAN sensors → gateway(s))
  • Rationale: Wide area coverage with minimal relay complexity for battery-powered devices

Smart City:

  • Primary: Partial mesh (streetlight gateways)
  • Secondary: Star (sensors → gateway)
  • Rationale: Coverage vs cost balance

Gateway Capacity Planning for Smart Building Deployment

Consider a 3-floor office building deploying 120 Wi-Fi IoT sensors (40 per floor). How many access points (APs) do we need?

Coverage calculation (area-based): \[ \text{AP range (indoor)} = 30\text{m radius} \Rightarrow \text{Coverage area} = \pi r^2 = \pi \times 30^2 = 2,827 \text{ m}^2 \] \[ \text{Floor area} = 50\text{m} \times 40\text{m} = 2,000 \text{ m}^2 < 2,827 \text{ m}^2 \]

Conclusion: 1 AP per floor (coverage) = 3 APs minimum

Capacity calculation (device limit): \[ \text{Typical AP capacity} = 50 \text{ simultaneous devices} \] \[ \text{Devices per floor} = 40 < 50 \Rightarrow \text{1 AP per floor (capacity OK)} \]

Bandwidth calculation (data throughput):

Each sensor sends 100 bytes every 60 seconds: \[ \text{Data rate per sensor} = \frac{100 \text{ bytes} \times 8 \text{ bits}}{60 \text{ s}} = 13.3 \text{ bps} \] \[ \text{Total per floor} = 40 \times 13.3 = 533 \text{ bps} \ll 54 \text{ Mbps (802.11g)} \]

Final design: 3 APs (star topology, 1 per floor) connected to core switch via Ethernet. Total cost: 3 × $150 = $450 for APs.

Try It: AP Capacity Planning Calculator
Try It: Mesh Network Scalability Calculator

15.7 💻 Hands-On Lab: Network Topology Design

15.7.1 Lab: Draw an IoT Smart Home Topology

Objective: Create logical and physical topologies for a smart home.

Devices:

  • 1× Internet gateway/router
  • 1× Zigbee hub
  • 3× Wi-Fi cameras
  • 5× Zigbee smart lights
  • 4× Wi-Fi temperature sensors
  • 2× Wi-Fi smart plugs
  • 1× Smart TV (Wi-Fi)

Task 1: Logical Topology

Draw logical topology showing: - Device types (use symbols or icons) - Connectivity (Wi-Fi vs Zigbee) - IP network ranges - Data flow to cloud services

Recommended tool: draw.io or Cisco Packet Tracer

Task 2: Physical Topology

Draw physical layout on house floor plan: - Gateway location - Camera placement (coverage areas) - Zigbee hub central location - Wi-Fi coverage from router - Identify potential dead zones

Expected deliverables:

  1. Logical topology diagram (PDF)
  2. Physical topology on floor plan (PDF)
  3. Brief explanation of topology choices

15.8 Knowledge Check

Test your understanding of network topology design, physical vs logical topologies, and mesh network scalability with these questions.


15.9 🐍 Python Implementations

15.9.1 Implementation 1: Network Topology Generator and Visualizer

This implementation generates star, ring, full mesh, and partial mesh topologies programmatically, then prints connection tables and connectivity statistics for each.

Expected Output:

======================================================================
NETWORK TOPOLOGY GENERATOR
======================================================================

1. STAR TOPOLOGY (5 devices)
----------------------------------------------------------------------

Topology: star
Nodes: 6, Links: 5

Connections:
  Central ↔ Device1
  Central ↔ Device2
  Central ↔ Device3
  Central ↔ Device4
  Central ↔ Device5

Statistics:
  Connectivity ratio: 33.33%
  Avg connections/node: 1.7

2. RING TOPOLOGY (6 nodes)
----------------------------------------------------------------------

Topology: ring
Nodes: 6, Links: 6

Connections:
  Node1 ↔ Node2
  Node2 ↔ Node3
  Node3 ↔ Node4
  Node4 ↔ Node5
  Node5 ↔ Node6
  Node6 ↔ Node1

Statistics:
  Connectivity ratio: 40.00%

3. FULL MESH TOPOLOGY (5 nodes)
----------------------------------------------------------------------

Topology: full_mesh
Nodes: 5, Links: 10

Connections:
  Node1 ↔ Node2
  Node1 ↔ Node3
  Node1 ↔ Node4
  Node1 ↔ Node5
  Node2 ↔ Node3
  Node2 ↔ Node4
  Node2 ↔ Node5
  Node3 ↔ Node4
  Node3 ↔ Node5
  Node4 ↔ Node5

Statistics:
  Total links: 10 (Formula: n(n-1)/2 = 5×4/2 = 10)
  Connectivity ratio: 100.00% (100% = full mesh)

4. PARTIAL MESH TOPOLOGY (8 nodes, 40% connection probability)
----------------------------------------------------------------------

Topology: partial_mesh
Nodes: 8, Links: 12

Connections:
  [12 random connections displayed...]

Statistics:
  Total links: 12 out of 28 possible
  Connectivity ratio: 42.86%

Key Concepts:

  • Star: Single point of failure (central node), easy to manage
  • Ring: Equal access, predictable performance, one break affects all
  • Mesh: Full mesh = n(n-1)/2 connections, expensive but highly redundant
  • Partial Mesh: Balance between cost and redundancy

15.9.2 Implementation 2: Topology Analyzer (Network Metrics)

This implementation uses BFS to find all paths between node pairs, then calculates network diameter, average path length, single points of failure (SPOFs), and a composite resilience score on a 0-1 scale.

Expected Output:

======================================================================
TOPOLOGY ANALYZER
======================================================================

1. STAR TOPOLOGY ANALYSIS
----------------------------------------------------------------------
Path D1 → D4:
  Shortest: D1 → Central → D4
  Hops: 2
  Total paths found: 1
  Redundant paths: 0

Network Metrics:
  Diameter: 2 hops
  Average path length: 1.67 hops
  Single points of failure: ['Central']
  Resilience score: 0.27 (0-1 scale)


2. PARTIAL MESH TOPOLOGY ANALYSIS
----------------------------------------------------------------------
Path N1 → N5:
  Shortest: N1 → N3 → N5
  Hops: 2
  All paths:
    Path 1: N1 → N3 → N5
    Path 2: N1 → N3 → N4 → N5
    Path 3: N1 → N2 → N3 → N5
    Path 4: N1 → N2 → N4 → N5

Network Metrics:
  Diameter: 2 hops
  Average path length: 1.80 hops
  Single points of failure: None
  Resilience score: 0.74 (0-1 scale)


3. TOPOLOGY COMPARISON
----------------------------------------------------------------------
Metric                    Star            Partial Mesh
----------------------------------------------------------------------
Diameter                  2 hops          2 hops
SPOFs                     Yes (Central)   None
Resilience                Low             Higher

15.9.3 Implementation 3: Mesh Network Scalability Calculator

This implementation calculates link counts and costs for full mesh versus partial mesh at different node counts, performs budget-based node optimization, and outputs topology recommendations based on network size and redundancy requirements.

Expected Output:

MESH NETWORK SCALABILITY ANALYSIS
==========================================================================================
Cost per link: $100.00
Partial mesh ratio: 30%
==========================================================================================
Nodes    Full Mesh       Partial Mesh    Full Cost       Partial Cost    Savings
         Links           Links           (USD)           (USD)           (%)
------------------------------------------------------------------------------------------
5        10              3               $1,000.00       $300.00         70.0%
10       45              13              $4,500.00       $1,350.00       70.0%
20       190             57              $19,000.00      $5,700.00       70.0%
50       1,225           367             $122,500.00     $36,750.00      70.0%
100      4,950           1,485           $495,000.00     $148,500.00     70.0%


DETAILED ANALYSIS: 20-node network
==========================================================================================
Nodes: 20

Full Mesh:
  Connections: 190
  Total cost: $19,000.00

Partial Mesh (30% connectivity):
  Connections: 57
  Total cost: $5,700.00
  Cost savings: $13,300.00 (70.0%)
  Estimated avg path length: 2.09 hops


BUDGET OPTIMIZATION
==========================================================================================
Budget $1,000 → Max 5 nodes (30% partial mesh)
Budget $5,000 → Max 19 nodes (30% partial mesh)
Budget $10,000 → Max 27 nodes (30% partial mesh)
Budget $50,000 → Max 62 nodes (30% partial mesh)


TOPOLOGY RECOMMENDATIONS
==========================================================================================

Small IoT sensor network, redundancy required:
  Nodes: 5
  Redundancy: True
  → Recommendation: Full mesh (only 10 links, affordable)

Small IoT sensor network, no redundancy required:
  Nodes: 5
  Redundancy: False
  → Recommendation: Star topology (simple, cost-effective)

Medium industrial network, redundancy required:
  Nodes: 15
  Redundancy: True
  → Recommendation: Partial mesh with 40-60% connectivity

Large smart building, redundancy required:
  Nodes: 50
  Redundancy: True
  → Recommendation: Partial mesh with 20-30% connectivity (1225 full mesh links would be excessive)

Key Insights:

  • Full mesh connections grow quadratically: n(n-1)/2
  • 100 nodes = 4,950 connections (impractical!)
  • Partial mesh reduces cost dramatically (70% savings at 30% connectivity)
  • Star topology best for small, cost-sensitive deployments
  • Partial mesh best for medium-large networks needing redundancy

15.10 💻 Advanced Hands-On Labs

15.10.1 Lab 3: ESP32 Network Topology Discovery Simulator

Objective: Simulate network topology discovery on ESP32.

Hardware Required:

  • ESP32 development board
  • USB cable
  • Computer with Arduino IDE

Code:

#include <WiFi.h>
#include <vector>
#include <map>

// Network node structure
struct Node {
  String id;
  std::vector<String> neighbors;
  bool discovered;
  int hopCount;
};

// Simulated network topology
std::map<String, Node> network;

void setup() {
  Serial.begin(115200);
  delay(2000);

  Serial.println("\n╔════════════════════════════════════════╗");
  Serial.println("║  Network Topology Discovery Simulator ║");
  Serial.println("║  ESP32 BFS-based Discovery             ║");
  Serial.println("╚════════════════════════════════════════╝\n");

  // Create sample topology (partial mesh)
  createSampleTopology();

  // Display topology
  displayTopology();

  // Run topology discovery
  Serial.println("\n═══════════════════════════════════════════════════");
  Serial.println("Running Topology Discovery (BFS from N1)");
  Serial.println("═══════════════════════════════════════════════════\n");

  discoverTopology("N1");

  // Analyze topology
  analyzeTopology();
}

void loop() {
  // Discovery runs once in setup()
}

void createSampleTopology() {
  // Create nodes
  network["N1"] = {"N1", {"N2", "N3"}, false, 0};
  network["N2"] = {"N2", {"N1", "N3", "N4"}, false, 0};
  network["N3"] = {"N3", {"N1", "N2", "N5"}, false, 0};
  network["N4"] = {"N4", {"N2", "N5"}, false, 0};
  network["N5"] = {"N5", {"N3", "N4"}, false, 0};

  Serial.println("Sample Topology Created (Partial Mesh):");
  Serial.println("  N1 connects to: N2, N3");
  Serial.println("  N2 connects to: N1, N3, N4");
  Serial.println("  N3 connects to: N1, N2, N5");
  Serial.println("  N4 connects to: N2, N5");
  Serial.println("  N5 connects to: N3, N4");
}

void displayTopology() {
  Serial.println("\n┌─────────────────────────────────────────┐");
  Serial.println("│          Network Topology               │");
  Serial.println("└─────────────────────────────────────────┘");
  Serial.println("Node  Neighbors            Degree");
  Serial.println("────────────────────────────────────────────");

  for (auto& pair : network) {
    Node& node = pair.second;
    String neighbors = "";
    for (size_t i = 0; i < node.neighbors.size(); i++) {
      neighbors += node.neighbors[i];
      if (i < node.neighbors.size() - 1) neighbors += ", ";
    }

    char line[60];
    sprintf(line, "%-5s %-20s %d", node.id.c_str(), neighbors.c_str(),
            node.neighbors.size());
    Serial.println(line);
  }
  Serial.println("────────────────────────────────────────────");
}

void discoverTopology(String startNode) {
  // BFS-based topology discovery
  std::vector<String> queue;
  queue.push_back(startNode);

  network[startNode].discovered = true;
  network[startNode].hopCount = 0;

  int round = 0;

  while (!queue.empty()) {
    Serial.printf("\n--- Discovery Round %d ---\n", round++);

    std::vector<String> nextQueue;

    for (const String& currentId : queue) {
      Node& current = network[currentId];

      Serial.printf("Exploring %s (hop %d):\n", currentId.c_str(),
                    current.hopCount);

      // Discover neighbors
      for (const String& neighborId : current.neighbors) {
        if (!network[neighborId].discovered) {
          network[neighborId].discovered = true;
          network[neighborId].hopCount = current.hopCount + 1;
          nextQueue.push_back(neighborId);

          Serial.printf("  → Discovered %s at hop %d\n",
                       neighborId.c_str(), network[neighborId].hopCount);
        } else {
          Serial.printf("  → %s already discovered\n", neighborId.c_str());
        }
      }
    }

    queue = nextQueue;
  }

  Serial.println("\n✓ Topology discovery complete!");
}

void analyzeTopology() {
  Serial.println("\n\n╔════════════════════════════════════════╗");
  Serial.println("║         Topology Analysis              ║");
  Serial.println("╚════════════════════════════════════════╝");

  // Calculate statistics
  int totalNodes = network.size();
  int totalLinks = 0;
  int maxDegree = 0;
  int minDegree = 999;
  int diameter = 0;

  for (auto& pair : network) {
    Node& node = pair.second;
    int degree = node.neighbors.size();

    totalLinks += degree;
    maxDegree = max(maxDegree, degree);
    minDegree = min(minDegree, degree);
    diameter = max(diameter, node.hopCount);
  }

  totalLinks /= 2;  // Each link counted twice

  // Calculate maximum possible links (full mesh)
  int maxPossibleLinks = totalNodes * (totalNodes - 1) / 2;
  float connectivity = (float)totalLinks / maxPossibleLinks * 100.0;

  float avgDegree = (float)(totalLinks * 2) / totalNodes;

  // Display statistics
  Serial.printf("\nNodes: %d\n", totalNodes);
  Serial.printf("Links: %d\n", totalLinks);
  Serial.printf("Max possible links (full mesh): %d\n", maxPossibleLinks);
  Serial.printf("Connectivity ratio: %.1f%%\n", connectivity);
  Serial.printf("\nDegree statistics:\n");
  Serial.printf("  Min degree: %d\n", minDegree);
  Serial.printf("  Max degree: %d\n", maxDegree);
  Serial.printf("  Avg degree: %.2f\n", avgDegree);
  Serial.printf("\nNetwork diameter: %d hops\n", diameter);

  // Topology type classification
  Serial.println("\nTopology classification:");
  if (totalLinks == totalNodes - 1) {
    Serial.println("  → Tree topology (minimal connectivity)");
  } else if (connectivity >= 95) {
    Serial.println("  → Full mesh (maximum redundancy)");
  } else if (connectivity >= 40) {
    Serial.println("  → Partial mesh (good redundancy)");
  } else if (maxDegree == totalNodes - 1 && minDegree == 1) {
    Serial.println("  → Star topology (central hub)");
  } else {
    Serial.println("  → Hybrid topology");
  }

  // Recommendations
  Serial.println("\nRecommendations:");
  if (connectivity < 30) {
    Serial.println("  ⚠ Low connectivity - consider adding links for redundancy");
  }
  if (diameter > 3) {
    Serial.println("  ⚠ High diameter - long paths may cause latency");
  }
  if (maxDegree > totalNodes / 2) {
    Serial.println("  ⚠ High-degree node detected - potential bottleneck");
  }
  if (connectivity >= 50) {
    Serial.println("  ✓ Good redundancy level");
  }
  if (diameter <= 2) {
    Serial.println("  ✓ Low diameter - efficient routing");
  }

  Serial.println("\n═══════════════════════════════════════════════════");
  Serial.println("Analysis Complete");
  Serial.println("═══════════════════════════════════════════════════\n");
}
🎮 Try It: ESP32 Network Simulator

Run this topology discovery algorithm in the browser! The simulation demonstrates BFS-based network discovery, calculating connectivity metrics, network diameter, and topology classification.

What to Observe:

  • BFS Discovery: Watch how the algorithm explores nodes level by level
  • Hop Counts: Each node gets assigned a distance from the start node
  • Topology Metrics: Connectivity ratio, degree distribution, diameter
  • Try: Modify the createSampleTopology() function to create different network structures (star, ring, full mesh)
╔════════════════════════════════════════╗
║  Network Topology Discovery Simulator ║
║  ESP32 BFS-based Discovery             ║
╚════════════════════════════════════════╝

Sample Topology Created (Partial Mesh):
  N1 connects to: N2, N3
  N2 connects to: N1, N3, N4
  N3 connects to: N1, N2, N5
  N4 connects to: N2, N5
  N5 connects to: N3, N4

┌─────────────────────────────────────────┐
│          Network Topology               │
└─────────────────────────────────────────┘
Node  Neighbors            Degree
────────────────────────────────────────────
N1    N2, N3               2
N2    N1, N3, N4           3
N3    N1, N2, N5           3
N4    N2, N5               2
N5    N3, N4               2
────────────────────────────────────────────

═══════════════════════════════════════════════════
Running Topology Discovery (BFS from N1)
═══════════════════════════════════════════════════


--- Discovery Round 0 ---
Exploring N1 (hop 0):
  → Discovered N2 at hop 1
  → Discovered N3 at hop 1

--- Discovery Round 1 ---
Exploring N2 (hop 1):
  → N1 already discovered
  → N3 already discovered
  → Discovered N4 at hop 2
Exploring N3 (hop 1):
  → N1 already discovered
  → N2 already discovered
  → Discovered N5 at hop 2

--- Discovery Round 2 ---
Exploring N4 (hop 2):
  → N2 already discovered
  → N5 already discovered
Exploring N5 (hop 2):
  → N3 already discovered
  → N4 already discovered

✓ Topology discovery complete!


╔════════════════════════════════════════╗
║         Topology Analysis              ║
╚════════════════════════════════════════╝

Nodes: 5
Links: 6
Max possible links (full mesh): 10
Connectivity ratio: 60.0%

Degree statistics:
  Min degree: 2
  Max degree: 3
  Avg degree: 2.40

Network diameter: 2 hops

Topology classification:
  → Partial mesh (good redundancy)

Recommendations:
  ✓ Good redundancy level
  ✓ Low diameter - efficient routing

═══════════════════════════════════════════════════
Analysis Complete
═══════════════════════════════════════════════════

15.10.2 Lab 4: Python Interactive Topology Visualizer

Objective: Create interactive network topology visualizations with NetworkX and Matplotlib.

Setup:

pip install networkx matplotlib

This creates a comprehensive visualization showing:

  1. Star topology with central hub highlighted
  2. Ring topology with directional flow
  3. Bus topology with shared medium
  4. Full mesh with all connections
  5. Partial mesh with selective connections
  6. Tree topology with hierarchical structure

Each subplot includes statistics about nodes, links, and key characteristics.


Scenario: A university campus needs to deploy environmental monitoring across 8 academic buildings spread over 500m × 400m area. Each building requires 30-50 sensors (temperature, humidity, CO2, occupancy).

Requirements:

  • Total sensors: ~320 devices
  • Data rate: 1 reading every 5 minutes per sensor
  • Reliability: Buildings can operate independently during network outages
  • Budget: $75,000 for networking infrastructure
  • Future expansion: 4 additional buildings planned in 2 years

Step 1: Analyze Building-to-Building Connectivity

Distance matrix (approximate):
Building A → B: 120m
Building A → C: 180m
Building B → D: 95m
...
Max distance: 380m (Building A → Building H)

Option 1 - Single Campus-Wide Mesh:

  • 320 sensors in one large Zigbee mesh
  • Problem: Zigbee hop range ~30m, would require 380m / 30m = 13 hops
  • Latency: 13 hops × ~50ms = 650ms (unacceptable for real-time occupancy)
  • Routing overhead: Large routing tables, slow convergence
  • Verdict: Rejected - doesn’t scale

Option 2 - Star with Centralized Gateway:

  • All 320 sensors connect to single LoRaWAN gateway
  • Problem: LoRaWAN duty cycle limit: 1% of 3,600 s/hour = only 36 seconds of airtime per hour per gateway
  • 320 sensors × 12 messages/hour × 2 seconds/message = 7,680 seconds of airtime needed per hour
  • 7,680 s needed >> 36 s allowed — exceeds limit by over 200×
  • Verdict: Rejected — far exceeds duty cycle limits for a single gateway

Step 2: Select Hybrid Topology

Recommended Architecture: Tree topology with mesh access

Campus Network (Tree Backbone)
        |
    [Core Switch]
        |
    10 Gbps Fiber Ring
        |
    +---+---+---+---+---+---+---+---+
    |   |   |   |   |   |   |   |   |
   [A] [B] [C] [D] [E] [F] [G] [H]  (Building Gateways)
    |   |   |   |   |   |   |   |
  (mesh)(mesh)(mesh)...               (Zigbee mesh per building)

Step 3: Cost Analysis

Component Quantity Unit Cost Total Cost
Fiber backbone 800m $45/m $36,000
Building gateway 8 $800 $6,400
PoE switch (per building) 8 $350 $2,800
Zigbee router (mains) 80 (10/building) $45 $3,600
Zigbee end device (battery) 240 (30/building) $25 $6,000
Core switch 1 $12,000 $12,000
Installation labor - - $8,200
Total $75,000

Step 4: Design Per-Building Mesh

Building A example (50 sensors): - 10 mains-powered Zigbee routers (placed in hallways) - 40 battery-powered sensors (in rooms) - Routers form mesh backbone (40% connectivity = 18 links) - Sensors connect to nearest router as end devices

Mesh metrics:

  • Max hops: 3 (sensor → router → router → gateway)
  • Latency: ~150ms worst-case
  • Fault tolerance: 2 routers can fail, network remains connected
  • Battery life: 2-3 years (sensors don’t route)

Step 5: Failure Analysis

Failure Impact Recovery
One sensor fails Only that sensor offline Replace sensor
One router fails 4-5 sensors reroute to next router Automatic (30 seconds)
Building gateway fails That building’s 50 sensors offline, other 7 buildings OK Replace gateway (manual)
Fiber cut between buildings Buildings isolated but locally functional ISP repair (hours to days)
Core switch fails All buildings offline Redundant core switch recommended

Step 6: Expansion Plan

For 4 additional buildings (2-year plan): - Cost per building: $1,200 (gateway + switch) + $900 (routers) + $750 (sensors) = $2,850 - Total expansion: 4 × $2,850 = $11,400 - Fiber extension: 200m × $45 = $9,000 - Total expansion: $20,400

Fiber backbone is already oversized (10 Gbps), no upgrade needed. Simply add buildings to existing tree structure.

Key Design Decisions:

  1. Why fiber backbone?
    • 500m × 400m campus exceeds Wi-Fi/Zigbee single-hop range
    • Fiber provides 10 Gbps future-proof bandwidth
    • Isolated buildings survive partial network failures
  2. Why Zigbee mesh within buildings?
    • 30-50m building dimensions suit Zigbee 30m hop range
    • Battery sensors connect as end devices (2-3 year life)
    • Self-healing handles router failures automatically
  3. Why tree (not flat mesh) backbone?
    • Hierarchical structure isolates building failures
    • Fiber provides reliable building-to-core connectivity
    • Easy to expand (add new buildings without reconfiguring existing)

Result: Hybrid tree-mesh topology provides isolation, scalability, and cost-effectiveness within budget. Buildings operate independently via local mesh, and fiber tree backbone aggregates data to campus data center.

Common Pitfalls

Paper designs look clean but miss RF coverage gaps and routing-table size limits. Fix: simulate every design in Cooja or a similar tool before ordering hardware.

Lab findings often reveal that the initial design underperforms. Fix: build at least two design-test-revise cycles into the project timeline.

A successful lab with 5 nodes on a bench does not validate a 200-node outdoor deployment. Fix: define a separate acceptance test with full node count and real-environment RF conditions.

15.11 Summary

  • Topology documentation requires both logical diagrams (communication flow) and physical diagrams (device placement and cable runs)
  • Professional tools like Visio, Cisco Packet Tracer, draw.io, and Ekahau enable standardized topology design and wireless planning
  • IoT-specific challenges include massive device counts, heterogeneous protocols, and wireless-dominant deployments requiring specialized visualization
  • Topology selection depends on fault tolerance needs, scalability requirements, and cost constraints for specific IoT applications
  • Mesh network scalability follows n(n-1)/2 formula - partial mesh balances cost and redundancy better than full mesh for large deployments
  • Topology analysis uses graph theory metrics like diameter, average path length, single points of failure, and resilience scores
  • Python implementations enable automated topology generation, network analysis, path finding, and scalability calculations for IoT design

15.13 Concept Relationships

Foundation Concepts:

Design Skills Applied:

Tools and Techniques:

Real Implementations:

15.14 See Also

Design Tools:

Reference Architectures:

Case Studies:

Hands-On Practice:

15.15 What’s Next

If you want to… Read this
Study specific topology types in depth Basic Types
Understand topology analysis metrics Topology Analysis
Explore hybrid topology design patterns Hybrid Design
Try the interactive topology simulator Interactive Topology
Review all topologies content Comprehensive Review