Ivan
Ivan

Reputation: 64227

How do I visualize a complex graph in .Net?

I need to visualize a graph. I don't know how to name it (by the way, if you know - I'll appreciate if you tell me). It would be ideal for graph elements to be clickable (so that when user clicks on a block, I can handle an event with the element id specified) but I can survive even without any interactivity. I may like to be able to focus on a particular node and layout all others to view from its perspective. Are there any components available good for this task? If no, what should I look for to help me to develop an algorithm for drawing such a graph with visually-comfortable layout?

Practical nature of this graph is pretty common: each block represents a derivation from 2 operands. Orange circles are references to 2 operands, green circles are connection points to consumers. It can be significant to distinguish an operand position (left or right), for example if a derivation represents a mathematical operation of difference or division (in this particular case a block can be triangular, but in other cases an operand itself can make use of being aware of for what blocks is it a left operand and for what blocks is it a right). Another common application is intersecting sets with complex relations.

Upvotes: 12

Views: 22006

Answers (10)

chtenb
chtenb

Reputation: 16204

This is a fairly new and maintained .NET wrapper for Graphviz: https://github.com/Rubjerg/Graphviz.NetWrapper

(Disclaimer: I'm the author)

This wrapper works differently from other wrappers, since it makes direct function calls to the native Graphviz code. This means you can not only programatically construct your graph in C# code, but also read the layout attributes back out in C# code and render it any way you want. The latter sounds specifically like something you would be interested in.

Upvotes: 1

Amir Pourmand
Amir Pourmand

Reputation: 629

As It seems Microsoft itself has done a really good job on graph visualization called automatic-graph-layout.

Here's the link https://github.com/microsoft/automatic-graph-layout.

Upvotes: 6

flq
flq

Reputation: 22859

I also would like to point you to graphviz. It is not a .NET solution but you can feed it files that are easy enough to write in order to create graphs. I don't think layouting is a very simple thing to do, especially with increasing node count, so it should be a good thing to find some tool for that.

Upvotes: 3

Paul Jackson
Paul Jackson

Reputation: 2147

Have used this commercial product with success: GoDiagram

It support the multiple ports on the nodes like you have shown.

Upvotes: 0

Steves
Steves

Reputation: 3234

Graphviz4Net provides WPF component for graphs visualization. It depends on GraphViz (open source command line graph visualization tool).

Upvotes: 2

ICR
ICR

Reputation: 14162

I don't know how useful it will be in this particular scenario, but you might want to take a look at http://quickgraph.codeplex.com/

Upvotes: 2

user90843
user90843

Reputation:

Well, you first need to represent it somehow in memory, there are many ways, like adjacency list. Then you need to draw it. While generally drawing a graph is simple, it's not that simple if you need to layout it. Looks like in your case, that's exactly what you need to do to come to that nice representation. It ain't going to be easy.

EDIT: Interesting, there seems to be a library made by Microsoft Research.

Upvotes: 2

Oliver
Oliver

Reputation: 45119

A quite good looking one is the Diagram tool from Nevron. But it's not for free!

I'm currently using the charts and user interfaces from them and they work quite good.

Upvotes: 0

Andriy Mytroshyn
Andriy Mytroshyn

Reputation: 221

I can not find this component and i decided writen my own control, line and head, and use them to visualization my graph's If the needed your i can give it's component and program to demonstrate him/ I writen component and program's in visual studio 2008 language C#

Upvotes: 1

Will Vousden
Will Vousden

Reputation: 33388

You could take a look at Graph#, but I'm not sure how well it'll handle composite nodes like that. It could be a good starting point though.

Upvotes: 5

Related Questions