Skip to content

Commit 2ad1624

Browse files
authored
Update readme with map reduce implementation.
1 parent 38560e4 commit 2ad1624

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Dijkstra.NET Dijkstra algorithm in [C#] [![NuGet Version](https://img.shields.io/badge/nuget-v1.0.4-blue.svg?style=flat)](https://www.nuget.org/packages/Dijkstra.NET)
1+
# Dijkstra.NET Dijkstra algorithm in [C#] [![NuGet Version](https://img.shields.io/badge/Nuget-1.0.5-blue.svg?style=flat)](https://www.nuget.org/packages/Dijkstra.NET)
22

33
Dijkstra algorithm which use priority queue thus complexity is equal O(ElogV) where E is number of edges and V is number of vertices. Used data structures are based on interfaces so you can implement your own or reused present. Simply example below. More information about algorithm you can find on the [wikipedia](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm).
44

@@ -20,9 +20,26 @@ graph.AddNode(2);
2020
graph.Connect(0, 1, 5, "some custom information in edge"); //First node has key equal 0
2121
2222
var dijkstra = new Dijkstra<int, string>(graph);
23-
DijkstraResult result = dijkstra.Process(0, 1); //result contains the shortest path
23+
IShortestPathResult result = dijkstra.Process(0, 1); //result contains the shortest path
2424
result.GetPath();
2525
```
26+
## Parallel version
27+
28+
Library provide parallel version of finding the shortest path in graph, it uses [breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search) algorithm and Map-Reduce technics. Parallel version use all cores to find the shortest path thus processing cost is higher than classic way, however it can gives quicker result when dense graph with similar weights was processed. Simple example below.
29+
30+
```c#
31+
var graph = new Graph<int, string>();
32+
33+
graph.AddNode(1);
34+
graph.AddNode(2);
35+
36+
graph.Connect(0, 1, 5, "some custom information in edge"); //First node has key equal 0
37+
38+
var bfs = new BfsParallel<int, string>(graph);
39+
IShortestPathResult result = bfs.Process(0, 1); //result contains the shortest path
40+
result.GetPath();
41+
```
42+
2643
## Benchmark
2744

2845
For Graph where number of vertices is 1 000 000 and number of edges is 10 000 000. Benchmark is available on the [benchmark](https://github.com/matiii/Dijkstra.NET/blob/benchmark/src/Dijkstra.NET/Dijkstra.NET.Benchmark/DijkstraBenchmark.cs) branch.

0 commit comments

Comments
 (0)