0

I'm working with the ReactFlow library to prototype a graph structure where nodes within a parent can only establish connections with other nodes within the same parent. The graph includes multiple parent nodes, each containing various child nodes. Child nodes are restricted from connecting with nodes outside of their parent, while parent nodes can connect with each other.

Could someone provide insights or suggestions on how to implement this flow effectively using ReactFlow?

Details:

  1. The prototype involves multiple parent nodes, each containing a set of child nodes.
  2. Child nodes are limited to connecting only within their parent node and cannot connect with nodes outside of their parent.
  3. Parent nodes have the ability to connect with other parent nodes within the graph.
  4. The goal is to maintain the connectivity and accessibility of nodes within each parent while enforcing connectivity restrictions across the graph.

Any insights, approaches, or relevant resources specific to ReactFlow would be appreciated. Thank you!

1 Answer 1

1

Figured it out. This is to help others.

There is a isValidConnection prop in ReactFlow component that can be used to allow/disallow connections. Using the useReactFlow hook ({getNodes, getEdges}), I was able to add my custom validation to prevent the connections.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.