caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pietro Abate <Pietro.Abate@pps.jussieu.fr>
To: caml-list@yquem.inria.fr
Subject: ocamlgraph ConcreteBidirectional and Dot
Date: Fri, 3 Apr 2009 14:37:19 +0200	[thread overview]
Message-ID: <20090403123719.GA12123@uranium.pps.jussieu.fr> (raw)

Hello all.

I've a small problem with ocamlgraph.
I want to parse a dot graph into a ConcreteBidirectional.

The problem is that the signature needed for Dot.Parse requires a function
edge, but I've no mean to specify a label (since it is unlabelled !!)... 

The functor for ConcreteBidirectional says E.t = (V.t * V.t), 
but I don't quite understand the type of B.G.E.label ... 

ConcreteBidirectional is of type Sig.I with
with type V.t = V.t and type V.label = V.t and type E.t = V.t * V.t

Sig.I includes Sig.G

and Sig.G has E: Sig.EDGE  with type vertex = vertex
but I'm missing the type of label for unlabelled graphs ... that should be
an implementation detail, isn't it ?

I tried to look at the implementation of per_imp.ml but I got a bit lost...

this is what I'm trying to do: 

-------------------
module V = struct
    type t = string
    let compare = Pervasives.compare
    let hash = Hashtbl.hash
    let equal l1 l2 = (l1 = l2)
end

module G = Imperative.Digraph.ConcreteBidirectional(V)

module B = Builder.I(G)

module L = struct
  open Dot_ast
  let node (id,_) attrs = match id with
    | Ident i -> i
    | Number n -> n
    | String s -> s
    | Html h -> h
  let edge l = ""
end

module DIn = Dot.Parse (B)(L)

---------------

the problem is:

Error: Signature mismatch:
       Modules do not match:
         sig
           val node : Graph.Dot_ast.id * 'a -> 'b -> string
           val edge : 'a -> string
         end
       is not included in
         sig
           val node :
             Graph.Dot_ast.node_id -> Graph.Dot_ast.attr list -> B.G.V.label
           val edge : Graph.Dot_ast.attr list -> B.G.E.label
         end
       Values do not match:
         val edge : 'a -> string
       is not included in
         val edge : Graph.Dot_ast.attr list -> B.G.E.label
Command exited with code 2.



             reply	other threads:[~2009-04-03 12:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-03 12:37 Pietro Abate [this message]
2009-04-03 14:40 ` [Caml-list] " Pietro Abate
2009-04-07  7:35 ` Jean-Christophe Filliâtre
2009-04-07 12:03   ` Re : " Matthieu Wipliez
2009-04-07 13:27     ` Jean-Christophe Filliâtre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090403123719.GA12123@uranium.pps.jussieu.fr \
    --to=pietro.abate@pps.jussieu.fr \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).