← Axon Interview Insights

Axon·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Axon software engineer interview with a graph traversal problem involving a heterogeneous entity model. Pretty standard algorithmically but the multi-type node setup added enough wrinkle to keep you on your toes.

Questions Asked (1)

Q1

You have three entity types: groups (which can nest other groups and users), users (who belong to groups and own devices), and devices (which belong to users). Given a starting entity, either a group or a user, return all reachable devices by traversing the membership graph. How do you handle cycles and visited tracking across the different node types?

Algorithms & Data StructuresSystem Design
Author's notes

The cycle handling part is what they actually cared about.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the membership graph as a directed graph where edges represent containment (group→group, group→user, user→device). Use a depth-first search (DFS) or breadth-first search (BFS) traversal, maintaining a visited set that tracks all visited nodes regardless of type to avoid cycles. Collect devices as you traverse and return the unique set.

Pro tip: Mention that using a single visited set for all node types is efficient and prevents cycles, but if you need to distinguish between revisiting a group vs. a user, you can use separate sets or a map keyed by node ID. Also, consider the trade-off between DFS (less memory for deep graphs) and BFS (finds shortest paths, useful if you need to limit depth).

1. Clarify the graph structure and requirements

Confirm that groups can contain groups and users, users belong to groups and own devices, and devices belong to users. Ask if there are any constraints like maximum depth or if devices can be shared.

2. Choose traversal algorithm and data structures

Select DFS or BFS based on requirements (e.g., BFS for shortest path to devices). Use a stack/queue for traversal and a visited set (e.g., HashSet) to track visited nodes across all types.

3. Implement traversal with cycle handling

Start from the given entity, mark it visited, and explore its connections. For each neighbor, if not visited, add to the traversal structure and mark visited. When a device is encountered, add it to the result set.

4. Collect and return devices

Ensure devices are collected uniquely (e.g., using a set). Return the list of devices after traversal completes.

5. Analyze complexity and edge cases

Discuss time complexity O(V+E) and space complexity O(V) for visited set. Mention edge cases like cycles, self-loops, and disconnected components.

Key Points to Mention

  • Use a single visited set for all node types to avoid cycles and redundant work.
  • Traverse using DFS or BFS; BFS can be beneficial if you need to find devices at minimal depth.
  • Handle cycles by checking visited status before adding to traversal structure.
  • Collect devices in a separate set to ensure uniqueness.
  • Time complexity is O(V+E) where V is number of entities and E is number of edges (memberships/ownerships).
  • Consider if devices can be reached via multiple paths; visited set prevents duplicates.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.