How to easily draw graphs in WPF?

Option 1: Microsoft Automatic Graph Layout

Free

http://research.microsoft.com/en-us/projects/msagl/

GitHub

https://github.com/Microsoft/automatic-graph-layout.git

Winforms >> WPF

It's WinForms, but it can be imported into WPF with a few lines of code.

Visualizing Nodes and Edges with Microsoft Automatic Graph Layout

http://www.codeguru.com/csharp/.net/net_wpf/article.php/c16963/Visualizing-Nodes-and-Edges-with-Microsoft-Automatic-Graph-Layout.htm

Examples

http://research.microsoft.com/en-us/projects/msagl/#Layouts

FAQ

http://research.microsoft.com/en-us/projects/msagl/faq.aspx

Option 2: QuickGraph - A 100% C# graph library with Graphviz Support

Free

http://quickgraph.codeplex.com/

This library is 100% C#. Don't be misled by the line "Graphviz Support", this means that it uses C# code to import the output from Graphviz. No C++ code in sight.

http://www.codeproject.com/Articles/5603/QuickGraph-A-C-graph-library-with-Graphviz-Sup

Has a NuGet package.

Under development from 2003 to 2011 (8 years!!).

Option 3: GraphSharp

Free

http://graphsharp.codeplex.com/

  • Depends on QuickGraph (which is 100% C#).
  • Supports async/await (nice!).

Demo

https://sachabarbs.wordpress.com/2010/08/31/pretty-cool-graphs-in-wpf/

Notes

This one worked really well, was up and running in a couple of hours. It also supports DataTemplates, so each node can have any look and feel that you want.

Option 4: Graphviz4net

Free

http://graphviz4net.codeplex.com/

Option 5: GoDiagram

$$$

http://www.nwoods.com/products/godiagram/index.html

Option 6: A Graph Tree Drawing Control for WPF

Free

http://www.codeproject.com/Articles/29518/A-Graph-Tree-Drawing-Control-for-WPF

No suitable. It's a tree layout.

Option 7: Using WPF to Visualize a Graph with Circular Dependencies

Free

http://www.codeproject.com/Articles/43776/Using-WPF-to-Visualize-a-Graph-with-Circular-Depen

Option 8: GraphViz

Free

http://www.graphviz.org/Download..php

This is not C#, and uses non-managed code. There are C# wrappers for it, however.

Opensourced by AT&T, see "AT&T Researchers — Inventing the Science Behind the Service", and "research home > portfolio > software tools": http://www.research.att.com/software_tools?fbid=NEk8_gxLLEc

Source

http://www.graphviz.org/Download_source.php

They also open sourced Rserve!

Option 9: Shields.GraphViz

Free

Wrapper for GraphViz.

https://github.com/timothy-shields/graphviz

Option 10: NetworkView: A WPF custom control for visualizing and editing networks, graphs and flow-charts

Free

http://www.codeproject.com/Articles/182683/NetworkView-A-WPF-custom-control-for-visualizing-a

This library allows the user to create connections between nodes, which is probably a bit of an overkill.

Example

https://channel9.msdn.com/coding4fun/blog/Noodling-Network-Nodes-Diagraming-with-the-NetworkView-custom-WPF-control

It's all MVVM.

Option 11: Gephi - The Open Graph Viz Platform

Free

See http://gephi.github.io/

Not a WPF graphing library, but provides great examples of how really nice graphs can look. The tutorial is excellent.

Option 12: Telerik

$$$

http://www.telerik.com/products/wpf/diagrams.aspx

Option 13: Infragistics

$$$

http://www.infragistics.com/samples/wpf/network-node/overview http://www.infragistics.com/samples/wpf/network-node/relationship-between-nodes http://www.infragistics.com/samples/wpf/network-node/custom-node-style

Option 14: WPF Diagram Designer

Free

Not so much graphing tool, but it does show you how to move, resize and rotate objects of any type on a canvas.

http://www.codeproject.com/Articles/22952/WPF-Diagram-Designer-Part-1

Option 15: MVVM Diagram Designer

Free

And, somebody reimplemented this in MVVM: Not so much graphing tool, but it does show you how to move, resize and rotate objects of any type on a canvas.

http://www.codeproject.com/Articles/484616/MVVM-Diagram-Designer

Option 16: yWorks - The Diagramming company

$$$

https://www.yworks.com/en/products_yfiles_practicalinfo_gallery.html https://www.yworks.com/en/products_yfileswpf_about.html

Option 17: MindFusion

$$$

http://www.mindfusion.eu/features-wpfdiagram.html http://www.mindfusion.eu/

Option 18: Dot2WPF

Free

A WPF control for viewing DOT graphs.

http://www.codeproject.com/Articles/18870/Dot-WPF-a-WPF-control-for-viewing-Dot-graphs

Option 19: SyncFusion

$$$

https://www.syncfusion.com/products/wpf/diagram

Option 20: AddFlow

$$$

https://www.componentsource.com/product/addflow-wpf-standard

Option 21: Lassalle

$$$

http://www.lassalle.com/

Option 22: Dynamic Data Display

http://dynamicdatadisplay.codeplex.com/

Option 23: Nevron

$$$

https://www.nevron.com/

Only for WinForms, but can be imported into WPF. However, each individual item cannot be templated, which is a big advantage of WPF solutions.

Google Search Terms

  • "workflow wpf graphing"
  • "wpf graphing library"
  • "wpf state machine library"

Graphviz + GraphViz C# Wrapper are exactly what I was looking for.


In a similar question on bipartite graphs which you can read here I got the recommendation on NetworkView

It has loops, vertex labeling, a custom vertex visualisation that you can easily edit to be circles. Think it has no edge labelling, though. Just give it a try.

At least it is a very good start if you decide to do it on your own.

You probably want to have a look on the Codeproject article "Visualize a graph with circular dependencies"


I think you can easily implement all of your requirements with GraphX library for WPF. It is based on Graph# and have detailed docs. http://panthernet.ru/en/projects-en/graphx-en

It supports edge labeleing and self-looped edges along with the edge and vertex templates. If you have any questions you can ask in the Discussions section on the site.

Tags:

C#

.Net

Wpf

Graph