ComradeVanti.FDijkstra 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ComradeVanti.FDijkstra --version 1.0.0
NuGet\Install-Package ComradeVanti.FDijkstra -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ComradeVanti.FDijkstra" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ComradeVanti.FDijkstra --version 1.0.0
#r "nuget: ComradeVanti.FDijkstra, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ComradeVanti.FDijkstra as a Cake Addin
#addin nuget:?package=ComradeVanti.FDijkstra&version=1.0.0

// Install ComradeVanti.FDijkstra as a Cake Tool
#tool nuget:?package=ComradeVanti.FDijkstra&version=1.0.0

FDijkstra

An F# implementation of Dijkstras algorithm

The implementation works with all sorts of graphs as long as it fulfills the following requirements:

  • It has vertices
  • It can find vertices connected to a specific vertex
  • It can measure the distance between two connected vertices

The general syntax for using the algorithm is

ComradeVanti.FDijkstra.Dijkstra.solve start goal vertices neighbors distanceBetween

with

  • start is the vertex where from which to begin the search
  • goal is the vertex where to which a path should be searched
  • vertices are all the vertices in the graph
  • neighbors is a function which finds adjacent vertices to a vertex
  • distanceBetween is a function which measures distance between two connected vertices

An example with actual values could be:

let vertices = [ 0; 1; 2; 3 ]

// Tuples are of the form ((vertex1, vertex2), distance)
let edges =
    [ ((0, 1), 2)
      ((1, 2), 4)
      ((2, 3), 3)
      ((1, 3), 7)
      ((0, 2), 4) ]

let neighbors v =
    [ edges
      |> List.filter (fst >> fst >> (=) v)
      |> List.map (fst >> snd)
      edges
      |> List.filter (fst >> snd >> (=) v)
      |> List.map (fst >> fst) ]
    |> List.concat

let distance v1 v2 =
    edges
    |> List.tryFind (fst >> (fun e -> e = (v1, v2) || e = (v2, v1)))
    |> Option.map snd
    |> Option.defaultValue 1000

solve 0 3 vertices neighbors distance
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 289 12/22/2021
1.0.2 217 12/21/2021
1.0.1 272 12/19/2021
1.0.0 241 12/18/2021