Is there any graph data structure implemented for C#

C#.NetData StructuresGraph Theory

C# Problem Overview

I tried to find a graph data structure to reuse in C# without any success. Of course, I can borrow from data structure books but I want it to be more commercially practical(?) Also I would appreciate if you can tell me what the best way of implementing a graph is. Thanks

C# Solutions

Solution 1 - C#


QuickGraph is a graph library for .NET that is inspired by Boost Graph Library.

QuickGraph provides generic directed/undirected graph datastructures and algorithms for .Net 2.0 and up. QuickGraph comes with algorithms such as depth first seach, breath first search, A* search, shortest path, k-shortest path, maximum flow, minimum spanning tree, least common ancestors, etc... QuickGraph supports MSAGL, GLEE, and Graphviz to render the graphs, serialization to GraphML, etc...

There are several ways to build graphs. The C++ Boost Graph Library (BGL) would be your best reference. It implements both adjacency-list, adjacency-matrix and edge-list graphs. Look here for details.

Solution 2 - C#

There is actually a fairly old article in MSDN that covers graph creation in C#, An Extensive Examination of Data Structures Using C# 2.0. Despite its age, it still addresses your question as long as you don't mind creating your own graph class(es).

Solution 3 - C#

Under active development, there is You can view source code on GitHub and also read the wiki


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTae-Sung ShinView Question on Stackoverflow
Solution 1 - C#Lior KoganView Answer on Stackoverflow
Solution 2 - C#Michael GoldshteynView Answer on Stackoverflow
Solution 3 - C#TomDaneView Answer on Stackoverflow