Relatively simple undirected graph library?

Hi, I've recently started learning Haskell and I'm looking for a library to create and manipulate undirected graphs for a small learning project. Ideally I'd like to be able to: - represent undirected or directed graphs with vertex type a and edge type b - not need to manually maintain mappings between vertex values and vertices assumed to be integers - be able to add and remove vertices and edges by their values with appropriate checks for missing vertices etc - find the connected components of a graph Looking on Hackage I can see some very sophisticated graph libraries including Data.Graph and Data.Graph.Inductive and others, but they all seem to need vertices to be integers or not support changing the graph once constructed. This may well be my ignorance of both graph theory and Haskell but can someone point me to a library that meets my needs or should I extend the learning process and create one myself? Thanks, Stu

On Mon, Jan 05, 2015 at 07:51:57AM +1100, Stuart Hungerford wrote:
Hi,
I've recently started learning Haskell and I'm looking for a library to create and manipulate undirected graphs for a small learning project. Ideally I'd like to be able to:
- represent undirected or directed graphs with vertex type a and edge type b
- not need to manually maintain mappings between vertex values and vertices assumed to be integers
- be able to add and remove vertices and edges by their values with appropriate checks for missing vertices etc
- find the connected components of a graph
Looking on Hackage I can see some very sophisticated graph libraries including Data.Graph and Data.Graph.Inductive and others, but they all seem to need vertices to be integers or not support changing the graph once constructed.
This may well be my ignorance of both graph theory and Haskell but can someone point me to a library that meets my needs or should I extend the learning process and create one myself?
Thanks,
Stu
Hi Stu I also was in need of a graph library comparable to what you describe, which I'd like to use later on to represent molecular graphs in cheminformatics projects. Since I did not find anything that fit my needs on Hackage, I started writing my own implementation. The code is not ready for anything and so far it's only unlabeled graphs. However, adding labelings later on is - from my experience - no big thing as most of the graph algorithms need only be implemented for unlabeled graphs. If you are interested, I could clean up the code and put it on github, then we could work on it together. Many of the things you need like creating edge- and vertex-induced subgraphs will require only very little work. The same goes for extracting connected subgraphs and filtering by edge or vertex type. Stefan

Hi Stefan! Although I don't need such a library for the moment, and although I'm still a beginner and I probably won't be able to improve your library I'd still love to see it on GitHub - just to check your code. So if you don't mind to have it online "for free" it would be really nice, if you'd put it on your GitHub! Thanks, Tim Am 05.01.2015 um 05:26 schrieb Stefan Höck:
Hi Stu I also was in need of a graph library comparable to what you describe, which I'd like to use later on to represent molecular graphs in cheminformatics projects. Since I did not find anything that fit my needs on Hackage, I started writing my own implementation. The code is not ready for anything and so far it's only unlabeled graphs. However, adding labelings later on is - from my experience - no big thing as most of the graph algorithms need only be implemented for unlabeled graphs. If you are interested, I could clean up the code and put it on github, then we could work on it together. Many of the things you need like creating edge- and vertex-induced subgraphs will require only very little work. The same goes for extracting connected subgraphs and filtering by edge or vertex type. Stefan _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

OK, I'll try and clean up the code and put it on GitHub. Mind that it's no big thing so far, but will hopefully evolve to something useful ... On Tue, Jan 06, 2015 at 09:55:16AM +0100, Tim Holzschuh wrote:
Hi Stefan!
Although I don't need such a library for the moment, and although I'm still a beginner and I probably won't be able to improve your library I'd still love to see it on GitHub - just to check your code.
So if you don't mind to have it online "for free" it would be really nice, if you'd put it on your GitHub!
Thanks, Tim
Am 05.01.2015 um 05:26 schrieb Stefan Höck:
Hi Stu I also was in need of a graph library comparable to what you describe, which I'd like to use later on to represent molecular graphs in cheminformatics projects. Since I did not find anything that fit my needs on Hackage, I started writing my own implementation. The code is not ready for anything and so far it's only unlabeled graphs. However, adding labelings later on is - from my experience - no big thing as most of the graph algorithms need only be implemented for unlabeled graphs. If you are interested, I could clean up the code and put it on github, then we could work on it together. Many of the things you need like creating edge- and vertex-induced subgraphs will require only very little work. The same goes for extracting connected subgraphs and filtering by edge or vertex type. Stefan _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (3)
-
Stefan Höck
-
Stuart Hungerford
-
Tim Holzschuh