GraphProvider
The GraphProvider project implements a state machine type provider..
The library can be installed from NuGet:
PM> Install-Package GraphProvider
Example
This example demonstrates the use of the GraphProvider:
1: 2: 3: 4: 5: 6: |
// reference the type provider dll #r "GraphProvider.dll" open GraphProvider // Let the type provider do it's work type Turnstile = Graph<"Turnstile.dgml"> |
Now we have full intellisense for the DGML file:
1: 2: 3: 4: 5: 6: 7: |
// Turnstile is locked initially Turnstile.StartFromLocked() val it : GraphProvider.Graph<...>.Locked2 = {Name = "Locked";} // Insert a coin and the turnstile is unlocked Turnstile.StartFromLocked().Coin() val it : Graph<...>.Unlocked2 = {Name = "Unlocked";} |
Finding shortest paths
Consider the following DGML file:
1: 2: 3: 4: 5: |
type Actors = Graph<"Actors.dgml"> // find the shortest path between Keanu Reeves and Kevin Bacon Actors.StartFromKeanuReeves().ShortestPathToKevinBacon() val it : List<string> = ["The Matrix"; "Laurence Fishburne"; "Mystic River"] |
Contributing and copyright
The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding new public API, please also consider adding samples that can be turned into a documentation. You might also want to read library design notes to understand how it works.
The library is available under Public Domain license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.
namespace GraphProvider
type Turnstile = Graph<...>
Full name: Index.Turnstile
Full name: Index.Turnstile
type Graph
Full name: GraphProvider.Graph
Full name: GraphProvider.Graph
Graph<...>.StartFromLocked() : Graph<...>.Locked2
type Actors = Graph<...>
Full name: Index.Actors
Full name: Index.Actors
Graph<...>.StartFromKeanuReeves() : Graph<...>.KeanuReeves2