[Haskell-cafe] Is the following implemented by a sparse matrix representation? type Graph n w = Array (n, n) (Maybe w)

Thomas Horstmeyer horstmey at Mathematik.Uni-Marburg.de
Wed Jul 10 14:10:06 CEST 2013


Looks like the graph is represented by an adjacency matrix, where the 
element at (a, b) tells you whether there is an edge from node a to node 
b with weight x or not by having the value (Just x) or Nothing, 
respectively.
Whether the matrix is sparse depends on the data, i.e. how many edges 
are in the graph.

But perhaps I misunderstood your question.

Thomas


Am 09.07.2013 23:26, schrieb KC:
> type Graph n w = Array (n,n) (Maybe w)



More information about the Haskell-Cafe mailing list