Back to problems

Build Transition Graph

Algorithm · Whatnot · Medium

You are provided with a list of server access logs that are not ordered. Each log entry is a three-element array: [ , , ]. Your task is to construct a transition graph that captures how users navigate between resources. For any given user, all timestamps are unique. Consider a user's chronological path through resources [r1, r2, ..., rN]. The transitions in this path are defined as "START" → r1, $$r1 \to r2$$, ..., and rN → "END". Here, "START" is a virtual state…

Checking your access…