Re: [Haskell-cafe] Graph type

2010-06-13 Thread C K Kashyap
Thanks Roman. I think I'll try out Data.Graph in that case. On Mon, Jun 14, 2010 at 8:53 AM, Ivan Lazar Miljenovic < ivan.miljeno...@gmail.com> wrote: > C K Kashyap writes: > > > I love this list ... thanks Roman. > > > > I take it that there is nothing obviously inefficient about this approach

Re: [Haskell-cafe] Graph type

2010-06-13 Thread Ivan Lazar Miljenovic
C K Kashyap writes: > I love this list ... thanks Roman. > > I take it that there is nothing obviously inefficient about this approach to > graph - as in the graph type. Sure there is (using p = |V|, q = |E|): * Finding a particular node is O(p). * Adding an edge to an already existing node is

Re: [Haskell-cafe] Graph type

2010-06-13 Thread C K Kashyap
I love this list ... thanks Roman. I take it that there is nothing obviously inefficient about this approach to graph - as in the graph type. On Mon, Jun 14, 2010 at 12:02 AM, Roman Cheplyaka wrote: > * C K Kashyap [2010-06-13 22:45:44+0530] > > Hi, > > I am trying to write a routine that wou

Re: [Haskell-cafe] Graph type

2010-06-13 Thread Roman Cheplyaka
* C K Kashyap [2010-06-13 22:45:44+0530] > Hi, > I am trying to write a routine that would generate a graph - where each > vertex would be a string. > > type Graph v = [(v,[v])] -- list of tuples of vertices and adjacent > vertices list > > addEdgeToGraph :: Graph -> String -> String -> Graph >

[Haskell-cafe] Graph type

2010-06-13 Thread C K Kashyap
Hi, I am trying to write a routine that would generate a graph - where each vertex would be a string. type Graph v = [(v,[v])] -- list of tuples of vertices and adjacent vertices list addEdgeToGraph :: Graph -> String -> String -> Graph I am having trouble coming up with the body of this functi