I am trying to understand your question.
is it possible for a path p to contain relationships of both type r and port? If so, what is the expected behaviour? Maybe it'd be easier to understand if you explain your query in English.
By the way, conventionally, node labels should be camel case (e.g., Ports) and relationships type should be all uppercase (e.g., PORT).
all() is a list predicate, it can only be used to evaluate a boolean based upon if all elements in the list adhere to the contained predicate. As such it cannot be used as any kind of updating structure.
I think what you want to do is use a FOREACH over a filtered list.
That said, I don't understand what you're trying to do with AGG. You haven't shown how you mean to use this, or what cycle you're referring to.
That is a means. But we don't know to what end. Please give a more comprehensive example showing the problem and desired output. There may be other approaches that could be used to fulfill what you want to do.
And whether a FOREACH is the right approach or not depends upon getting the full picture.
Drew schematically. The relationships have a parameter and we go from the start node. Look at the parameter of the start node. In the example, it is 2. This means that the path must be selected further using this initial parameter, i.e. = 2. The rest of the path is not valid. How do I make it not try to go over links that have a parameter that is not equal to the initial parameter (that is, 2)