From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 9FE33BBAF for ; Thu, 12 Mar 2009 15:38:33 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlEDAOu6uEmBrw8EgWdsb2JhbACVNAEBFiK9MoQNBg X-IronPort-AV: E=Sophos;i="4.38,351,1233529200"; d="scan'208";a="36463826" Received: from ext.lri.fr ([129.175.15.4]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 12 Mar 2009 15:38:33 +0100 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id 380DFA43B9; Thu, 12 Mar 2009 15:38:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lri.fr Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QOGcEh+8Gl-I; Thu, 12 Mar 2009 15:38:33 +0100 (CET) Received: from [192.168.1.47] (163.45.64-86.rev.gaoland.net [86.64.45.163]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ext.lri.fr (Postfix) with ESMTP id E398EA432A; Thu, 12 Mar 2009 15:38:32 +0100 (CET) Message-ID: <49B91E68.5020508@lri.fr> Date: Thu, 12 Mar 2009 15:38:32 +0100 From: Jean-Christophe Filliatre User-Agent: Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: Matthieu Wipliez Cc: OCaml Subject: Re: Re : [Caml-list] changing labels on ocamlgraph edges References: <5F21734C-C88E-4401-8EB4-811681A42E67@gmail.com> <1236844549.22473.184.camel@localhost> <366870.61081.qm@web27007.mail.ukl.yahoo.com> In-Reply-To: <366870.61081.qm@web27007.mail.ukl.yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; filliatre:01 filliatre:01 lri:01 matthieu:01 bool:01 wrote:01 graph:01 graph:01 caml-list:01 edges:01 edges:01 int:01 boolean:01 labels:03 labels:03 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 -- Jean-Christophe