0

How do I find the index idx, such that dist[idx] is minimum, but only amongst those whose visited[idx] is false ? The context is for an implementation of Dijkstra's algorithm.

1 Answer 1

3
min((idx for idx in indexes if not visited[idx]), key=lambda idx: dist[idx])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.