If I understand this right, you want to change the cost of the edge in the graph depending on the nodes that are visited in your current path. Example from comments:
"Edge AB has a length of 3, but if you also visit node C, the length of AB will be 5"
, , Djikstra, , "" node . , "" node (- , ), , , , , NP , , Dijikstra. +1 .