<div dir="ltr">Right, of course! Thanks again, Ivan!</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 13, 2015 at 2:58 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"><span class="">On 14 August 2015 at 06:14, Jeffrey Brown <<a href="mailto:jeffbrown.the@gmail.com">jeffbrown.the@gmail.com</a>> wrote:<br>
> What about changing an edge's label? Again all I can think of is to replace<br>
> the edge with a new one, but that seems likely inefficient, particularly if<br>
> I wanted to handle a lot of edges as a batch.<br>
<br>
</span>If you're doing it as a batch, then it might be worth using emap;<br>
otherwise, for a single edge do the same procedure: for an edge<br>
(u,v,l), match on `u`, adjust the `(l,v)` in the fourth field of the<br>
Context and put it back with &.<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> On Thu, Aug 6, 2015 at 3:41 PM, Ivan Lazar Miljenovic<br>
> <<a href="mailto:ivan.miljenovic@gmail.com">ivan.miljenovic@gmail.com</a>> wrote:<br>
>><br>
>> 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>
>><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>
>> > --<br>
>> > which works, but seems like its speed must be linear in the number of<br>
>> > 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,<br>
>> >> '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<br>
>> > I<br>
>> > have to do a lot of that?<br>
>> ><br>
>> > _______________________________________________<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>
>><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>
><br>
><br>
<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>
</div></div></blockquote></div><br></div>