4

I am interested in finding a good c++ library (or base code upon which to create one) to draw interactive connected graph components in Qt.

By connected graph component, I mean graphs whose nodes are components with input and output sections in the style of graph nodes in Blender Node Editor or Grasshopper, see example.

By interactive, I mean that I need to be able to access the component position and locations to let the user select and interact with them.

My requirements:

  • for Qt in C++
  • least amount of external dependencies (best would be just a header library)
  • support for automatic layout (or semi-automatic, the nodes being set, the edges having to be connected automatically)
  • interactivity-enabled (i.e. not just an image output, most likely based on QGraphicsScene)

My current implementation is using GraphViz with QGV but it only support simple component nodes (no specific input / output elements). While GraphViz supports record and html elements, QGV doesn't and it looks like a sufficient hassle to implement it within a fork of QGV correctly given the constraints from GraphViz that I wonder if there is no better choice, trying to not use GraphViz.

I could also be fine with a simple non-graphics library that does the layout given size constraints and relative position constraints (the component blocks have a fixed size, the input/output nodes positions are fixed given the location of the component block).

1 Answer 1

3

Maybe too late but still here is the library I develop for general-purpose node graph editing.

https://github.com/paceholder/nodeeditor

Key Features:

  • Based on Qt 5.x with C++14
  • Based on QGraphicsScene
  • Nodes are behaving according to user-defined models
  • No dependencies (just Qt).
  • Different color styles

Check the video to see what the library is capable of: 1

3
  • It is a bit late for me to use it for the project I was planning it for, indeed, but it's worth having it mentioned somewhere. I may look at it if I happen to need it in a new system. Do you know how well it scales to larger graphs? I'm talking about a few hundreds of nodes, which is quite common for algorithm-based systems. One I found out about later (but in Python is that of Antimony, a Media Lab project for CAD, mattkeeter.com/projects/antimony/3), and it seems to scale up to some level. Commented Dec 19, 2016 at 19:46
  • 1
    In terms of the graph rendering performance it scales pretty well as it is based on the super-fast QGraphicsScene engine. If we talk about signal propagation, I assume it must be a little slower than a Python script (for example). Internally I use std::shared_ptr to wrap user's data and to pass it to the next model. This requires some memory allocations and shared pointer copying. Anyway, one guy managed to make a real-time GLSL renderer based on this Node Editor with a dozen of primitives that delivered 30-60 FPS (github.com/v0q/CollaborativeResearchProject)
    – paceholder
    Commented Dec 20, 2016 at 21:35
  • This is exactly what I've been looking for, absolutely stunning! @paceholder
    – Moia
    Commented Mar 5, 2019 at 11:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.