caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Orlin Grigorov" <ogrigorov@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Data structure for a directed bipartite graph
Date: Wed, 10 Oct 2007 12:52:38 -0400	[thread overview]
Message-ID: <b17e12b30710100952t7669e0e9pcdf73d9b4b4bbee6@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]

A bipartite graph is a graph, which has two kinds of nodes, and every node
is connected only to nodes from the other kind.  In other words, if the two
types of nodes are A and B, then there can be an edge between nodes of type
A to nodes of type B (resp. edge from B to A), but never an edge between A
and A, or B and B.

So, I was thinking about a data structure in OCaml, in which I want to store
such graph, and also to allow me easy access to elements, as well as adding
new nodes and edges (therefore, the structure would be imperative, that is,
will have a state).

So, how about this:

1) an array, which holds all the nodes and the information about them (e.g.
type of the node, other info contained in it)

2) a two dimensional array, indicating existence of an edge between each two
nodes.

Maybe it's worth mentioning that the number of nodes for my particular
purposes will never be more than 200, so I don't think the matrix will take
up too much memory?!

Thank you in advance.   I am in the process of producing my Master's thesis
in Canada, and I am just starting to make an implementation in OCaml, which,
even though newly discovered language by me, for a very short time became my
favorite!

[-- Attachment #2: Type: text/html, Size: 1281 bytes --]

             reply	other threads:[~2007-10-10 16:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-10 16:52 Orlin Grigorov [this message]
2007-10-10 18:34 ` [Caml-list] " Vincent Aravantinos
2007-10-10 19:36 ` Jean-Christophe Filliatre

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=b17e12b30710100952t7669e0e9pcdf73d9b4b4bbee6@mail.gmail.com \
    --to=ogrigorov@gmail.com \
    --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).