adaptatron's blog

By adaptatron, 3 hours ago, In English

Given an undirected graph, define the cost of a path as the MEX of all the edge weights on the path. Define $$$dist(u, v)$$$ as minimum possible cost across all paths from $$$u$$$ to $$$v$$$. Practice Problem

  • Compute all pairwise distances.
  • Given a subset of vertices, find the minimum cost to make them connected. Adding an edge $$$(u, v)$$$ costs $$$dist(u, v)$$$.

I created a video talking about how to solve these in $$$O(N^2 \cdot E)$$$ followed by an optimization for $$$O(N \cdot E)$$$.

  • Vote: I like it
  • -3
  • Vote: I do not like it