Support Forum

Is it possible to remove nodes with a certain tag from the list generated by the "BFS" function?

Hello. It’s me again. :smiley:
In my game, using the “BFS” function, I check the availability of nodes at the end of the path. I want to make it so that it would be possible to pass through some nodes, but you can’t stop at these nodes, my characters are there. To do this, I need a list of nodes that do not have characters. How can I do that?
I read the documentation about BFS. But I misunderstood what was written there. If I mark certain areas with a tag, will the function not add to the list those areas that will become impassable as a result of this?
Or is it better to make two lists. One using the function “bfs” and the other a list with tags and subtract one list from another. I’m just not very good with lists.
Please tell me the best way to do this?

Hi

I don’t quite understand what exactly you want, but if I take the question in the topic title then it should be as simple as:

using System.Linq;

var nodes = PathUtilities.BFS(...).Where(node => node.Tag != tagToRemove).ToList();
1 Like

I know English as well as with Sharp, so this is all online translator. But this line of code is similar to the one that I need.

Thank you very much.

Could you still help with this?

And could you help with this one?
Is it possible to do it in one line of code too? Color the line. How to do this with a large code, I understood approximately.