<div dir="ltr">What about changing an edge's label? Again all I can think of is to replace the edge with a new one, but that seems likely inefficient, particularly if I wanted to handle a lot of edges as a batch.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 6, 2015 at 3:41 PM, Ivan Lazar Miljenovic <span dir="ltr"><<a href="mailto:ivan.miljenovic@gmail.com" target="_blank">ivan.miljenovic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The easiest way of changing the label of one node is to obtain its<br>
Context using `match`, and update the label in the Context and then<br>
put it back in the graph with (&).<br>
<br>
Ignoring log factors (which are from the graph implementations, not<br>
the FGL model) this ends up being O(|degree of node|).<br>
<div><div class="h5"><br>
On 7 August 2015 at 08:29, Jeffrey Brown <<a href="mailto:jeffbrown.the@gmail.com">jeffbrown.the@gmail.com</a>> wrote:<br>
> Is changing the label at a node O(N)?<br>
><br>
> The only way I can think of to do it is with a map, like the following --<br>
> which works, but seems like its speed must be linear in the number of nodes<br>
> of the graph:<br>
><br>
>> :m Data.Graph.Inductive.Example Data.Graph.Inductive.Graph<br>
>> let f c@(adjIn, node, lab, adjOut) = case node of {1 -> (adjIn, node, 'b',<br>
>> adjOut); _ -> c}<br>
>> loop<br>
> mkGraph [(1,'a')] [(1,1,())]<br>
>> gmap f loop<br>
> mkGraph [(1,'b')] [(1,1,())]<br>
>><br>
><br>
> Is that in fact the right way? Am I somehow missing the point of FGL if I<br>
> have to do a lot of that?<br>
><br>
</div></div>> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Ivan Lazar Miljenovic<br>
<a href="mailto:Ivan.Miljenovic@gmail.com">Ivan.Miljenovic@gmail.com</a><br>
<a href="http://IvanMiljenovic.wordpress.com" rel="noreferrer" target="_blank">http://IvanMiljenovic.wordpress.com</a><br>
</font></span></blockquote></div><br></div>