How to find multidimensional path of exact 0 cost with 1, 0, -1 weights
问题 I was given directed graph with n nodes and edges with weigths of vectors (every vector has length m) of numbers 1, 0, -1. I would like to find any path (or say that such path doesn't exist) from one node to other (we can visit nodes many times) such sum of its weights equals to vector of only zeros. I was thinking of bruteforce backtracking algorithm but it is not guaranteed that it would end. Can we somehow limit length of such path in terms of n and m? Example of graph for n=8, m=2 Example