Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

236
Vistas
What would be an algorithm to check if two people would meet as they traverse a graph using dijkstra's algorithm?

Imagine 2 people starting a two different starting points in a 2D matrix. They would also have separate end points when they traverse the matrix. Traversing from two points has a corresponding difficulty (weight). Using Djikstra's algorithm, we can determine what would be the best route to take for both person to reach their destination. Given that a person can only move to one node at a time and both persons move simultaneously, what would be a good algorithm to determine if they would bump to each other as they traverse the matrix?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When you perform two Djikstra's searches from two initial vertices, you update dist[] and prev[] arrays (looking at Wiki pseudocode)

Add additional array steps[] (for distance in number of edges), and when you modify prev[v] ← u, also make steps[v] = steps[u] + 1

When you read shortest path by reverse iterations, compare if vertices of intersection of two paths contain the same value in steps

For example, you found that paths intersect in vertices 3 and 7. But A_steps[3] = 3, B_steps[3] = 2 - so persons walk through this cell in differen moments. And if A_steps[7] = 6, B_steps[7] = 6 means that persons do meet in this node at the sixth step.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda