LeetCode 200: Number of Islands With Union-Find

Subtitle / Summary Do not start this problem by memorizing a Union-Find template. Start from the pressure: each land cell looks like one island at first, but adjacent land cells must collapse into one connected component. Reading time: 10-12 min Tags: Hot100, Union-Find, DSU, matrix, connected components SEO keywords: LeetCode 200, Number of Islands, Union-Find, DSU, connected components Meta description: A pressure-first Python guide to LeetCode 200 that derives land-only count, 2D-to-1D ids, Union-Find merges, and the final runnable solution. Problem Requirement You are given an m x n 2D character grid: ...

July 2, 2026 · 7 min · map[name:Jeanphilo]

LeetCode 684: Redundant Connection With Union-Find

Subtitle / Summary The key signal in this problem is not a component count. It is a failed union: if two endpoints are already connected, adding the current edge closes a cycle. Reading time: 8-10 min Tags: Union-Find, DSU, graph, tree, cycle detection SEO keywords: LeetCode 684, Redundant Connection, Union-Find, DSU, cycle detection Meta description: A pressure-first Python guide to LeetCode 684 that derives 1-indexed Union-Find, bool-returning union, ordered edge scanning, and final checks. Problem Requirement You are given an undirected graph. It started as a tree with n nodes labeled from 1 to n, then one extra edge was added. ...

July 2, 2026 · 7 min · map[name:Jeanphilo]

Union-Find Template: Derive find / union / count

Subtitle / Summary Union-Find is not a pair of function names to memorize first. It solves one concrete problem: decide whether two nodes already belong to the same set, and merge two sets when a connection appears. Reading time: 10-12 min Tags: Hot100, Union-Find, DSU, graph, connectivity SEO keywords: Union-Find, DSU, Disjoint Set Union, find, union, count, path compression Meta description: A Python Union-Find template guide that derives parent, find, union, count, connected, path compression, and connected component counting. A - Algorithm: Start From Set-Merging Pressure Tiny task: merge sets and answer connectivity Suppose we have 5 nodes: ...

June 30, 2026 · 10 min · map[name:Jeanphilo]

LeetCode 547: Number of Provinces, Turn an Adjacency Matrix into Connected Components

Problem Requirement You are given an n x n matrix isConnected, where there are n cities. If isConnected[i][j] == 1, city i and city j are directly connected. If two cities can reach each other through one or more directly connected cities, they belong to the same province. The problem asks you to return the total number of provinces. The easiest mistake is to think that the answer is the number of 1s in the matrix, or only the number of directly connected pairs. That is not what the problem asks. ...

May 29, 2026 · 16 min · map[name:Jeanphilo]

LeetCode 133: Clone Graph Hash Map + DFS/BFS ACERS Guide

Subtitle / Summary Clone Graph is not a traversal-only problem. The real challenge is preserving graph structure while avoiding duplicate copies in the presence of cycles. The stable solution is a traversal plus a hash map from original nodes to cloned nodes. Reading time: 12-15 min Tags: graph, dfs, bfs, hash map, deep copy SEO keywords: Clone Graph, graph deep copy, DFS, BFS, LeetCode 133 Meta description: Deep-copy an undirected graph with a node-to-node map, explaining why memoization is mandatory and how DFS/BFS versions work, with runnable code in six languages. Target Readers LeetCode learners practicing graph traversal and deep-copy patterns Engineers who duplicate object graphs, workflow graphs, or topology graphs Developers who want one reusable template for “clone with cycles” Background / Motivation Many “copy” problems are actually identity-preservation problems. ...

March 19, 2026 · 11 min · map[name:Jeanphilo]

Community Detection Primer: Engineering Trade-offs Between Louvain and Label Propagation - ACERS Analysis

Subtitle / Abstract Community detection is not just “splitting a graph into a few groups.” In production, you must balance accuracy, interpretability, speed, and maintainability. Following the ACERS structure, this article breaks down two of the most common engineering choices: Louvain (modularity optimization) and Label Propagation (LPA). Estimated reading time: 12-16 minutes Tags: Community Detection, Louvain, Label Propagation, Graph Partitioning SEO keywords: community detection, Louvain, Label Propagation, modularity, graph partition Meta description: Engineering primer for community detection: principles, complexity, algorithm selection, and implementation templates for Louvain and LPA across group discovery, graph partitioning, and cold start. Target Audience Engineers working on social graphs, risk-control graphs, or recommender-system graph analytics Developers who want to move community detection from paper concepts into production workflows Practitioners modeling group structure for graph partitioning and cold-start scenarios Background / Motivation Community detection appears frequently in production: ...

February 9, 2026 · 10 min · map[name:Jeanphilo]

k-hop and Reachability Queries: BFS Limits, Reachability Indexes, and 2-hop Labeling ACERS Analysis

This article walks through k-hop and reachability queries in practice: BFS+hop limits, transitive-closure tradeoffs, and engineering rollout paths for bitmap indexes and 2-hop labeling.

February 9, 2026 · 12 min · map[name:Jeanphilo]

BFS / DFS Engineering Primer: k-hop Queries, Subgraph Extraction, and Path Existence ACERS Breakdown

Subtitle / Abstract BFS / DFS are not just about “being able to code them.” You need production-ready behavior, predictable cost, and provable correctness. Following the ACERS structure, this article breaks three common tasks (k-hop query, subgraph extraction, and path existence) into reusable templates: iterative implementation + early stop + visited structure selection. Estimated reading time: 12-16 minutes Tags: Graph, BFS, DFS, k-hop, subgraph extraction SEO keywords: BFS, DFS, k-hop query, subgraph extraction, path existence, visited bitmap, bloom filter Meta description: BFS/DFS for engineering scenarios: iterative implementations to avoid stack overflow, early stop to cut search cost, and visited bitmap/bloom to optimize memory and dedup performance. Target Audience Engineers working on graph databases, risk-control relationship graphs, or call-chain analysis Learners who can write “problem-solution style BFS/DFS” but do not yet have engineering templates Developers who want traversal code that is stable, observable, and extensible Background / Motivation In production systems, BFS/DFS is usually not a one-off offline script. It is part of an online request path: ...

February 9, 2026 · 15 min · map[name:Jeanphilo]