I would like to know if there is a formula that can detect a circular reference.
Take the example below:
Mickey Mouse and Donald Duck refer to each other as manager. Is there any way Knime can detect these cases and put them on a seperate list? The case of Goofy Dog is correct, and should be ignored.
Provided that the circular reference can only be on one level (Employee to immediate Manager) I was thinking of something like this:
1) From the initial data table, you can use twice a String Manipulation node to create a new column as Manager|Employee and another one as Employee|Manager. If there is a circular reference, the first column will contain A|B and B|A, the second column will contain B|A and A|B
2) Join the table with itself (Inner Join) using the two added columns as Joining Columns. This will filter out all lines that do not have a match between the first and the second column.
3) You end up with a table containing only the circular references.
The only down-side is that each circular reference appears twice because A|B from the first column matches A|B from the second one (Manager to Employee circular reference) and B|A from the first column also matches B|A from the second one (Employee to Manager circular reference), but you get anyway your list of circular references.
Hello Otter, hello Marco,
Attached you will find a solution that lists circular references of arbitrary lengths. It's not beautiful but it works.