Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hello guys! I am making a node-based editor(the same idea as in 3ds max, nuke, flowstone etc).What i am trying to figure out now is how to draw the connexions between the nodes(I mean I could just draw a straight line, but I want something more elegant), more specifically how do I draw them when they are many nodes and many connexions. I am trying to find a way such that they don't overlap one with each other or with the nodes. How do I draw them(with a function, some pathfinding algorithm...)?

P.S. Just to make myself a little more clear I'm trying to avoid a mess like this[^]

P.S.2 I am more interested in ideas rather than actual code.
Posted
Updated 25-Oct-14 11:37am
v2

1 solution

Short answer: start by looking at what the open-source GraphViz library offers: [^]. Google has a .NET wrapper for GraphViz: [^]. Note: I have not worked directly with GraphViz, or its .NET wrapper.

I assume you do realize that creating what you might call "minimum-static" visual representations of dynamic graphs of object relationships (parent-child, arbitrary linkages, etc.) is, potentially, a major project whose complexity can increase exponentially depending on the number of objects, the number of their linkages, and the extent to which you want to enable an end-user to interact directly (mouse, touch, keyboard) with the visual representation.

Getting that kind of functionality is why people pay big $ for components like Nevron Diagram.

It is also true that many prototypes of "visual programming" have made an attempt at creating ui's that enable this through drag/drop, creating (what in Nevron Diagram are called ports and plugs) linkages by direct action (drag-drop, click-drag, etc.).

The problem with many of these experiments (like the 1980's Miller Puckette's (later David Zicarelli's) Max for midi-programming on the Macintosh) is that all too soon, as complexity of linkages increases, the visual representation becomes a plumbing nightmare :) Max a la Zicarelli is still alive: [^] !

I suggest you start off by searching for currently available open-source graphing/routing packages that may give you ideas, or usable code: [^].

For C# ? [^].

Also, note that CP has an 'Algorithms forum: [^].
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900