I am looking for a solution to the following problem:
dp <- c('a','x','b','z','c')
rf <- c('b','z','c','a','a')
df <- data.frame(dp, rf)
For this example dataframe i want to recognize, if there are cycles from dp
to rf
. Such a cycle would be in this example: a --> b, b --> c, c --> a. In this case i would like to remove the row where dp = c
and rf = a
. The cycle can be longer than just over these 3 dependencies.
Thanks in advance for helping!