97

I am looking for Graph libraries for .net. Are there any out?

ps: I mean GRAPH libraries, not graphics nor charting libraries!

edit: What I mean is graphs, from graph theory: alt text
(source: sourceforge.net)

I also need it to have drawing capabilities.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
devoured elysium
  • 101,373
  • 131
  • 340
  • 557

13 Answers13

46

Use a combination of QuickGraph (GitHub, CodePlex) and Graph# for WPF (GitHub fork, CodePlex) - both top notch libraries. They work really well for me but the documentation for Graph# is almost non-existant.

Deilan
  • 4,740
  • 3
  • 39
  • 52
Matt Breckon
  • 3,374
  • 20
  • 26
17

I am working in the NDepend team and we switched from GraphViz to MsAgl (Microsoft Automatic Graph Layout) in september 2008. The MsAgl license allows commercial utilisation. Here are a few sample pictures of MsAgl graphs integrated in NDepend (everything is interactive, nodes are movable/selectable/removable/clickable, edges are editable/selectable/removable/clickable, the layout is zoomable, and also, while it could be cleaner the MsAgl API is clean enough to work with):

enter image description here enter image description here enter image description here

Sachin Joseph
  • 18,928
  • 4
  • 42
  • 62
Patrick from NDepend team
  • 13,237
  • 6
  • 61
  • 92
  • Can also play with AGL at http://rise4fun.com/Agl and see graphs from others there at http://rise4fun.com/rest/samples/rss/Agl – George Birbilis May 20 '15 at 12:16
  • 3
    Note that MSAGL is now OpenSource under MIT license at GitHub: https://github.com/Microsoft/automatic-graph-layout and seems to be maintained, since some fix for Silverlight version has been pushed recently – George Birbilis May 20 '15 at 12:17
  • Regarding trying AGL at the Rise4Fun site I've mentioned, maybe is a simple option for brainstorming, but you only enter the graph in text form there and the labels you use for nodes are used as IDs in that text syntax, so I guess you can't have a node with the same label (say House) at two places in the graph. Seems you can also use labels for edges of the graph too (for the links), using the syntax shown at http://rise4fun.com/Agl/fsm (press PLAY button there and then scroll down to see what graph is generated) – George Birbilis May 20 '15 at 12:29
  • Where can I download a stable binary version? I don't want to build every source of unknown quality. – Thomas Weller Jun 18 '16 at 18:26
  • I guess here https://github.com/Microsoft/automatic-graph-layout not sure if binary version is included – Patrick from NDepend team Jun 20 '16 at 12:39
13

Though my previous post get deleted I'll try to give more complex answer on the question. The topmost answer is not quite actual anymore as the Graph# library is strongly outdated.

I'll recommend to check the combination of GraphX and Quickgraph. GraphX as the rendering engine and Quickgraph as the graph management and math operation component.

GraphX library is coded for WPF 4.0 and METRO. It provides many features that Graph# lacks:

  • Improved rendering performance for large graphs
  • Edge routing and bundling support, many other edge options
  • Enhanced zoom control which supports Overview window and multiple vertices selection
  • Rich documentation and samples

Also GraphX supports all the original layout algorithms from Graph#.

Alexander Smirnov
  • 1,573
  • 12
  • 23
9

There is QuickGraph, it works pretty well and has most of the basic algorithms.

Doug McClean
  • 14,265
  • 6
  • 48
  • 70
5

Take a look at yWorks: http://www.yworks.com/en/index.html

There aren't a massive amount of good libraries out there, from what I've seen.

A S
  • 416
  • 3
  • 5
5

You can use the NodeXL API from Microsoft Research at: http://www.codeplex.com/NodeXL but a similar question has been asked at: https://stackoverflow.com/questions/44090/do-you-know-any-graph-visualization-libraries-for-net/

Community
  • 1
  • 1
DrDee
  • 3,549
  • 6
  • 30
  • 37
  • Sounds nice, but from what I saw now from their examples, it seems you basically have to draw everything by yourself, which would be a problem as I have thousands of nodes to draw. – devoured elysium Oct 16 '09 at 15:30
  • I am not quite sure what you mean by 'to draw everything by yourself', NodeXL is both an extension for Excel but also an API for .Net and it supports graph layouts algorithms like force-directed layout (Fruchterman-Reingold or Harel-Koren fast multiscale) or a geometrical layout (circle, grid, spiral, etc.). I have used it myself and there is not much 'manual' work – DrDee Oct 16 '09 at 15:42
  • I was speaking of other thing, I got confused with a different reply. But seems like NodeXL requires Office 2007. I don't even have office installed. – devoured elysium Oct 16 '09 at 18:13
  • I already installed this. Now how am I supposed to use it from c#? – devoured elysium Oct 17 '09 at 13:24
  • make sure you install the API library and not the Office Excel extension. The API is available at: http://www.codeplex.com/NodeXL/Release/ProjectReleases.aspx?ReleaseId=33672 The namespace of NodeXL is Microsoft.NodeXL so you can import it using: import Microsoft.NodeXL.Core import Microsoft.NodeXL.Visualization (I think those two are the most important libraries). Just make sure that the path of your IDE contains the NodeXL folder. – DrDee Oct 18 '09 at 23:26
  • I've just tried it and you don't need Office. – Andy Aug 24 '12 at 13:11
4

Take a look at Satsuma. Written in C#, mainly graph algorithms, but there is some basic graph layout and drawing as well.

szali
  • 498
  • 3
  • 11
3

I haven't tried it yet but ran across an interesting offering from MS Research for visualizing directed graphs Microsoft Automatic Graph Layout.

Try using "directed graph" or "digraph" for search terms. I get a lot of hits.

Emmanuel
  • 3,475
  • 6
  • 29
  • 45
2

Check out http://quickgraph.codeplex.com/ They have support for visualization via DotViz and Glee.

For visualization, i'd also check out

http://flare.prefuse.org/

Though its flash, it seems very interesting, and they have at least tree visualization, though you may be able to coax some non-directed graphs out of it.

JBland
  • 1,263
  • 10
  • 13
0

The C5 Generic Collection Library for C# and CLI

jjchiw
  • 4,375
  • 1
  • 29
  • 30
  • Doesn't that just contain some *examples* of graph algorithms built on the collection data structures? I'd have guessed the question asks for something like the C++ BGL library (http://www.boost.org/doc/libs/1_40_0/libs/graph/doc/index.html). – Pontus Gagge Oct 16 '09 at 14:50
  • You're right Pontus. There is a Graph class in the user guide examples but it is not part of the library. It's an example built on top of it. And a messy, incomplete one at that from looking at the source. – Paul Sasik Oct 16 '09 at 14:59
  • But it can be used, well it's like an approach....... – jjchiw Oct 16 '09 at 15:02
0

Buddy I think this is what you need!

This article presents a Generic Graph Library, 100% C#. This library is an attempt to port the Boost Graph Library (BGL) from C++ to C#.

Sandeep Datta
  • 28,607
  • 15
  • 70
  • 90
0

We've used ZedGraph which is an Open Source project written in C#, so you can tweak it if you feel it is necessary. It served our needs which sound like they're very close to what you described. There's even a wiki site for the project with some pretty good samples.

Walter
  • 2,540
  • 2
  • 30
  • 38
0

Matlab has good support for graphing, and with a few lines of .NET you can call a .m file to display graphs. See Creating a graph or a plot from a C# console app, using Matlab?

Community
  • 1
  • 1
Contango
  • 76,540
  • 58
  • 260
  • 305