I have a list of directed edges for a graph and I want to replace all edges that match a certain pattern. The edges should be replaced by a number. It ends up in a edge weighting list for a graph. All edges that go to "window" should have the same weight. Therefore the replacement. I tried this:
ReplaceList[{"a" \[DirectedEdge] "window",
"window" \[DirectedEdge] "door"},
y_ \[DirectedEdge] x_ /; x == "window" -> 2]
The pattern matching does not work in this case. The goal is to replace only edges were "window" is the receiving vertex. Is there a way to do it in similar fashion to above trial? Can the pattern matching made to work in ReplaceList?