Graph library for RDF-like in-memory graphs. Efficient either-direction traversals. Provides depth-first, breadth-first and random-first traversals, topological sort, path finding, and page rank algorithms. Supports Dotgraph for rendering output which is very helpful when debugging.
Create a graph using RDF-like predicates on nodes of any type.
var g = new Graph<string, Relation>();
g.AddStatement("a", Relation.RDFSType, "b");
g.AddStatement("a", Relation.RDFSType, "c");
g.AddStatement("b", Relation.RDFSType, "d");
g.AddStatement("c", Relation.RDFSType, "e");
g.AddStatement("d", Relation.RDFSType, "f");
g.AddStatement("e", Relation.RDFSType, "f");
And then traverse it, union it, intersect it, find paths, topological sorts, page rank, ...
var sorted = string.Join("", g.TopologicalSortApprox());
sorted.Should().Be("abcdef");
var path = g.ShortestPath(a, Relation.RDFSType, e, (r) => 1.0, (x, y) => x + y);
string result = string.Join(";", path);
result.Should().Be("a;c;e");
- Performance when traversing a graph in both directions.
- Full control over Node and Edge type including the ability to use Nodes as Edges in true RDF 'turtles-all-the-way-down' fashion.
- Compact in memory representation for very large in-memory graphs.
- Immutable data structures wherever possible.
- Complete set of algorithms including exploration, path finding, union, topological sort and page rank.
- Support for Dotgraph rendering of graphs.
Available on nuget as https://www.nuget.org/packages/Abodit.Graph