We are creating a workflow builder. We want to allow only unidirectional flows

component 1 --> component 2
component 2 --> component 3
component 3 --> component 4

We have allowed multiple links to the input ports of the components as we require multiple components to connect to one component.

But, I should not allow connection in the opposite direction. For example in the above senario, i should not allow a connection from component 4 to component 2. How can i identify such links? these create an infinite loop in my workflow and i want to prevent the end user from drawing such links.

Set Diagram.validCycle to go.Diagram.CycleNotDirected.

Please read https://gojs.net/latest/intro/validation.html#CyclesInGraphs.