caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alexy Khrabrov <deliverable@gmail.com>
To: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr>
Cc: Matthieu Wipliez <mwipliez@yahoo.fr>, OCaml <caml-list@inria.fr>
Subject: Re: Re : [Caml-list] changing labels on ocamlgraph edges
Date: Thu, 12 Mar 2009 20:10:19 -0400	[thread overview]
Message-ID: <D2BEC9AC-5678-4F6E-8E69-B375C9185C1E@gmail.com> (raw)
In-Reply-To: <49B91E68.5020508@lri.fr>

On Mar 12, 2009, at 10:38 AM, Jean-Christophe Filliatre wrote:
> 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

And another clarification: if you add_edge_e, the edge e is sA->vB- 
 >dC, and exactly such an edge exists already, nothing happens.   That  
is, if you just call add_edge v1 v2 repeatedly, only one edge is ever  
created.  However, if you add an edge with the same src, dst, but a  
different label, which can only be done with G.E.create, and add it  
with add_edge_e, then it's added and you have several edges.

Another aspect is that if you add an edge and any vertex in it is not  
yet in the graph, it's added into the graph as well.

I sense that several important and intuitive operations are missing,  
namely

G.add_edge_lavel v1 v2 label

G.E.create would look better if the label were the trailing argument,  
or leading optional one with the type-based default value

G.get_edge_label and G.set_edge_label are needed just like those for  
Mark'ing vertices -- that would simplify labeling the edges and make  
it more natural.

While I was experimenting with changing the edge labels by removing  
old edges and adding new ones with just a different label, I found  
that performance is OK -- a graph with 35K vertices and 2,5 million  
edges, of those 80K unique (src,dst), is created in 8 minutes with  
add_edge v1 v2 and 9.5 minutes with remove/add where the label is a  
count of total edges between the vertices.  Then it's stored as a  
graph with integer edges, not references, and marshals into almost the  
same size as the default-labeled graph.  So it would be nicer and  
easier to allow such labels instead of making the user to explicitly  
mark references.

Finally, it's very annoying to see plural of vertex as also "vertex"  
-- in G.nb_vertex or iter_vertex; it's "vertices"! :)  Also nb_ is a  
non-standard abbreviation for "number of", perhaps better names are  
num_vertices and num_edges?

Cheers,
Alexy


  reply	other threads:[~2009-03-13  0:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12  1:47 Alexy Khrabrov
2009-03-12  7:55 ` [Caml-list] " Julien SIGNOLES
2009-03-12 12:47   ` Re : " Matthieu Wipliez
2009-03-12 14:38     ` Jean-Christophe Filliatre
2009-03-13  0:10       ` Alexy Khrabrov [this message]
2009-03-13 10:53         ` Re : " Matthieu Wipliez

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=D2BEC9AC-5678-4F6E-8E69-B375C9185C1E@gmail.com \
    --to=deliverable@gmail.com \
    --cc=Jean-Christophe.Filliatre@lri.fr \
    --cc=caml-list@inria.fr \
    --cc=mwipliez@yahoo.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).