Quick Overview

Determine whether a proposed directed edge is new and can be added to an existing DAG without creating a cycle. Reject self-loops and duplicates, then test whether the destination already reaches the source through the original graph.

Validate Adding an Edge to a Directed Acyclic Graph

Company: Hive.Ai

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

Overview: Determine whether a proposed directed edge is new and can be added to an existing DAG without creating a cycle. Reject self-loops and duplicates, then test whether the destination already reaches the source through the original graph.

Loading…