Skip to content

Commit 86142bc

Browse files
authored
Update README.md
1 parent 51a8cc4 commit 86142bc

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

README.md

Lines changed: 20 additions & 5 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/Dijkstra.NET-1.2.0-blue.svg)](https://www.nuget.org/packages/Dijkstra.NET)
1+
# Dijkstra.NET [![NuGet Version](https://img.shields.io/badge/Dijkstra.NET-1.2.0-blue.svg)](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 [Wikipedia](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm).
44

@@ -12,23 +12,38 @@ Install the latest version from NuGet
1212
## Simple example
1313

1414
```c#
15-
using Dijkstra.NET.Extensions;
15+
using Dijkstra.NET.Graph;
16+
using Dijkstra.NET.ShortestPath;
1617

1718
var graph = new Graph<int, string>();
1819

1920
graph.AddNode(1);
2021
graph.AddNode(2);
2122

22-
graph.Connect(0, 1, 5, "some custom information in edge"); //First node has key equal 0
23+
graph.Connect(1, 2, 5, "some custom information in edge"); //First node has key equal 1
2324
2425
ShortestPathResult result = graph.Dijkstra(0, 1); //result contains the shortest path
2526
26-
result.GetPath();
27+
var path = result.GetPath();
28+
```
29+
or
30+
31+
```c#
32+
using Dijkstra.NET.Graph;
33+
using Dijkstra.NET.ShortestPath;
34+
35+
var graph = new Graph<int, string>() + 1 + 2;
36+
37+
bool connected = graph >> 1 >> 2 >> 5 ^ "custome edge information";
38+
39+
ShortestPathResult result = graph.Dijkstra(1, 2); //result contains the shortest path
40+
41+
var path = result.GetPath();
2742
```
2843

2944
## Benchmark
3045

31-
For Graph where number of nodes is 10 000 000 and connections between them 1 000 000. The length of path is minimum 10.
46+
For Graph where number of nodes is 1 000 000 and connections between them 1 000 000. The length of path is minimum 10.
3247

3348
``` ini
3449

0 commit comments

Comments
 (0)