Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
changing labels on ocamlgraph edges
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-03-12 (14:38)
From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@l...>
Subject: Re: Re : [Caml-list] changing labels on ocamlgraph edges
Matthieu Wipliez wrote:
> I'm also using ocamlgraph with labels of type t = bool ref * int option
> And I found that for add_edge to have the proper behavior, I need to replace the default add_edge with this one:
>   let add_edge graph v1 v2 = add_edge_e graph (v1, (ref false, None), v2)
> Otherwise all edges share the same reference (created in "default"), and changing the boolean for an edge changes it for all edges...

May be we should document add_edge more carefully, so that it is clear 
that it makes use of the default edge label, and that, consequently, 
this label is shared among all edges created with add_edge

Indeed you have to use add_edge_e instead to avoid sharing