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=1.3 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 3BEB9BBAF for ; Thu, 12 Mar 2009 13:47:31 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtABAKuguEnZkrEHmWdsb2JhbACMc4hGAQEBAQEICwoHEaxAgQaPJgEEhA0 X-IronPort-AV: E=Sophos;i="4.38,350,1233529200"; d="scan'208";a="25479145" Received: from web27007.mail.ukl.yahoo.com ([217.146.177.7]) by mail1-smtp-roc.national.inria.fr with SMTP; 12 Mar 2009 13:47:30 +0100 Received: (qmail 62246 invoked by uid 60001); 12 Mar 2009 12:47:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1236862050; bh=IVT1/fvLQHS4gWQTCZN+7QWNha6CAvaDbb0HWcBJlgk=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=cmmjatoxc1kXEuzc7h3gDwsfDfyYAa7ZQc/5IHpJP/q0H95S7gJihjkDS+g+CXYcgKPuCJ/1pp7iWVqg5o0B1aG2f4mV94+WETBx17Vg3Ng2xpngVbfiHH/tG0nKMmTxDU+pgUWfEQATsXL3Dc24Q4tRRVOzLkdbQbevZfptGpY= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Mrldlu5TvPzNv95XVIZ/Rwo2U4uv6THi+m4EyIfthz4KDlzV4dJwuqSQVDoSJitGuIyWoRk86ujPS7FJIN6HH06wz20pDR7Sbvml1gTFZW9zMmu9Dk2yY/3ke2bh4wmURuSlC7AWQxol9CfzxwKGvgqSAd3mZ4ourmKqikB4YuU=; Message-ID: <366870.61081.qm@web27007.mail.ukl.yahoo.com> X-YMail-OSG: c3ACBTAVM1mZFeZYPX0tV.yIFq8xNG4FmMncPJ8jlyST7G1yc9Wkh7033SxqXa6oE7TeZwRWajHHGA2UhtuTiGxKp30h65Njv4zRPfwOYG89MxKfdJ2LDrgsauBIVlrOYrPVgdwvreQ4As6sW6dGERYjTWjREwnqezWwJptMw5I6.qtPK0u3bEMPmiyCgLhZ.nNJCNIgufoc9X9QDHe8pbpyMTdVQWVP4izMb3oknw6gkms- Received: from [193.52.94.5] by web27007.mail.ukl.yahoo.com via HTTP; Thu, 12 Mar 2009 12:47:29 GMT X-Mailer: YahooMailRC/1155.45 YahooMailWebService/0.7.289.1 References: <5F21734C-C88E-4401-8EB4-811681A42E67@gmail.com> <1236844549.22473.184.camel@localhost> Date: Thu, 12 Mar 2009 12:47:29 +0000 (GMT) From: Matthieu Wipliez Subject: Re : [Caml-list] changing labels on ocamlgraph edges To: OCaml MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; matthieu:01 mutable:01 struct:01 hash:01 hashtbl:01 hash:01 struct:01 pervasives:01 bool:01 cheers:01 matthieu:01 printf:01 foo:01 foo:01 signoles:01 > No it is not :-). You just have to define yourself a mutable label. Here= =0A> is an example.=0A> =0A> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A> open Graph= =0A> =0A> module G =3D =0A> Imperative.Digraph.ConcreteLabeled=0A> (s= truct include String let equal =3D (=3D) let hash =3D Hashtbl.hash end)=0A>= (struct =0A> type t =3D int ref =0A> let default =3D ref= 0 =0A> let compare =3D Pervasives.compare=0A> end)=0A=0AI'm al= so using ocamlgraph with labels of type t =3D bool ref * int option=0AAnd I= found that for add_edge to have the proper behavior, I need to replace the= default add_edge with this one:=0A let add_edge graph v1 v2 =3D add_edge_= e graph (v1, (ref false, None), v2)=0A=0AOtherwise all edges share the same= reference (created in "default"), and changing the boolean for an edge cha= nges it for all edges...=0A=0ACheers,=0AMatthieu=0A=0A> =0A> let g =3D G.cr= eate ()=0A> =0A> let print_edge v1 v2 =3D =0A> Format.printf "edge =3D %d= @." !(G.E.label (G.find_edge g v1 v2))=0A> =0A> let e =3D G.E.create "foo" = (ref 1) "bar"=0A> let () =3D =0A> G.add_edge_e g e;=0A> print_edge "foo= " "bar";=0A> G.E.label e :=3D 2;=0A> print_edge "foo" "bar"=0A> =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=0A> =0A> Hope this helps,=0A> Julien Signoles=0A> = =0A> _______________________________________________=0A> Caml-list mailing = list. Subscription management:=0A> http://yquem.inria.fr/cgi-bin/mailman/li= stinfo/caml-list=0A> Archives: http://caml.inria.fr=0A> Beginner's list: ht= tp://groups.yahoo.com/group/ocaml_beginners=0A> Bug reports: http://caml.in= ria.fr/bin/caml-bugs=0A=0A=0A=0A