Skip to content

Commit

Permalink
Add a note about edge-labelled graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
snowleopard committed Oct 22, 2018
1 parent 454af9f commit c3edf0a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ and allow the application of equational reasoning for proving the correctness of
To represent *non-empty graphs*, we can drop the `Empty` constructor -- see module
[Algebra.Graph.NonEmpty](http://hackage.haskell.org/package/algebraic-graphs/docs/Algebra-Graph-NonEmpty.html).

To represent *edge-labelled graphs*, we can switch to the following data type, as
explained in my [Haskell eXchange 2018 talk](https://skillsmatter.com/skillscasts/12361-labelled-algebraic-graphs):

```haskell
data Graph e a = Empty
| Vertex a
| Connect e (Graph e a) (Graph e a)
```

Here `e` is the type of edge labels. If `e` is a monoid `(<+>, zero)` then graph overlay can be recovered
as `Connect zero`, and `<+>` corresponds to *parallel composition* of edge labels.

## How fast is the library?

Alga can handle graphs comprising millions of vertices and billions of edges in a matter of seconds, which is fast
Expand Down

0 comments on commit c3edf0a

Please sign in to comment.