Find Overlapping Fiber Routes and Single Points of Failure from KMZ Files
Company: Millennium
Role: Machine Learning Engineer
Category: System Design
Difficulty: medium
Interview Round: Technical Screen
You are given a batch of KMZ files (zipped KML, the format Google Earth uses) that describe fiber-optic cable routes and the circuits carried over them. Design how you would find the paths that overlap and the single points of failure in this network. The interviewer then asked how you would plan redundancy for circuits, and how you would handle KMZ data with format errors or inconsistent coordinate systems.
Assume each route is drawn as one or more polylines (KML `LineString` elements) of longitude/latitude points, possibly with point placemarks for sites such as data centers, huts or splice points. How the files tie circuits to routes, the size of the network and the expected output were not reported; settle them with the interviewer.
### Clarifying Questions
- How do the files tie a circuit to the routes it uses: does each circuit list its route segments, or must the mapping be inferred from geometry?
- What counts as an overlap: cables in the same conduit or trench, routes within some distance of each other, or routes that pass through the same site? What distance tolerance matches how accurately the routes were drawn?
- What counts as a single point of failure: a site, a route segment, or any location where one cut would sever several routes at once?
- How many files, routes and vertices are there, and is this a one-off analysis or one that reruns whenever the files change?
- Are the sites present as placemarks, or must junctions be derived from where lines meet?
- What output do the planners want: overlapping stretches per circuit pair, a ranked list of single points of failure, a map layer?
### Part 1: Find overlapping paths and single points of failure
Parse the files, find the stretches where routes physically overlap (so that one cut could sever all of them), and find the single points of failure for the network and for each circuit.
```hint Geometry and topology answer different questions
Ask what a spatial comparison of the drawn lines can reveal that a graph of sites and links cannot, and the reverse.
```
```hint Drawn lines are approximate
Two cables in the same trench are rarely drawn with identical coordinates. Decide how your comparison tolerates that, and in what units you measure it.
```
#### What This Part Should Cover
- Extracting geometries and attributes from KMZ/KML, and measuring distance in meters rather than degrees
- Pruning candidate pairs with a spatial index, then testing overlap with a distance tolerance and a minimum shared length
- A graph of sites and segments, and the elements whose loss splits the network or disconnects a circuit's endpoints
- Running time and memory at the agreed scale
### Part 2: Plan circuit redundancy
How would you plan redundancy so that a single cut cannot take a circuit down?
```hint Diversity is physical
Two paths over different fiber strands can still share a trench or a bridge crossing. Pin down what "separate" must mean before you search for a second path.
```
#### What This Part Should Cover
- A precise definition of physical diversity that includes the geometric overlaps found in Part 1
- An algorithm for two diverse paths with minimum combined cost, and why choosing the shortest path first can fail
- What to report and recommend when full diversity is impossible
### Part 3: Handle malformed files and inconsistent coordinates
Some KMZ files contain format errors, and coordinates are not consistent across files. How do you handle this?
```hint Fail one file, not the batch
Think about where in the pipeline each kind of defect can be detected, what happens to a file or placemark that fails, and how that affects the trust you can place in the results.
```
#### What This Part Should Cover
- Validation at each layer (archive, XML, geometry) with quarantine and error reports instead of failing the whole batch
- Normalizing to one coordinate reference system, and detecting swapped or out-of-range coordinates
- Results that state what was excluded, so missing data is never read as "no overlap"
### What a Strong Answer Covers
- Definitions of overlap, diversity and single point of failure agreed before any algorithm
- Geometric and graph analysis combined, since each alone misses real common failure points
- Correct algorithms with complexity: spatial indexing, articulation points and bridges, minimum-cost disjoint paths
- An ingestion pipeline that quarantines and reports bad files or placemarks, processes the rest of the batch, and is honest about coverage
- Output planners can act on, ranked by how many circuits each finding affects
### Follow-up Questions
- Three supposedly diverse routes converge for a short stretch to cross a river on the same bridge. How does your analysis catch it, and how do you present it?
- The KMZ batch changes every week. How would you recompute only what changed?
- How would you rank the single points of failure so planners fix the most important ones first?
- Two circuits share no drawn route, but both enter one building through the same conduit, which is not in the files. What data would you need, and how would you model it?
Overview: A network design question built on a batch of KMZ files describing fiber routes and circuits. It asks how to detect where routes physically overlap and where single points of failure exist, how to plan physically diverse redundant paths, and how to handle malformed files and inconsistent coordinate systems.
Read the full Millennium Machine Learning Engineer interview experience this question came from