[erlang-questions] How to access digraph vertices

Tue Jun 3 16:16:30 CEST 2014

Hi Toben,
Many thanks. Aw, so simple. I should have thought of that.
I'm working on a db that has a strong hierarchical structure similar to:
fiction | non-fiction
genre1 genre2 ...
author1 author2 ...
book1 book2
Queries would look like:
1) List all genres
2) List all authors in genre
3) Select author
3) List all books in genre
4) List all books in genre
5) Select book
Many times more reads than writes. As I understand,  the whole structure has to be built in RAM. Genres could, conceivably be factored into separate graphs of up to several hundred books and authors/genre.
Which leaves the questions:
1) Is a transaction-like technique available to permit write graph structure to disk with losing record writes coming in in the meantime?
2) Any gains or simply querying a flat db?
3) Is there a yet better way?
Thanks again,
-----Original Message-----
From: "Torben Hoffmann" <torben.hoffmann@REDACTED>
Sent: Tuesday, June 3, 2014 2:28am
To: "Lloyd R. Prentice" <lloyd@REDACTED>
Cc: "Erlang Users' List" <erlang-questions@REDACTED>
Subject: Re: [erlang-questions] How to access digraph vertices

Hi Lloyd,
Lloyd R. Prentice writes:

> Hello,
> The documentation for digraphs tells us that vertices can be any Erlang term.
> How would we retrieve a vertex expressed as a record? E.g., by key. Surely we
> wouldn't want to use or even know the whole record. 
Not quite sure what it is you are trying to do here, maybe an example would help us
(or just me) understand what you are up to.

Even though vertex() is term() I would not push a record into the vertex. I would
push the key in as the vertex() type and let the record be the label of the vertex.

But, again, it highly depends on what the use case is... hint, hint!!
Might be that digraph is not the right way to solve your problem.


> Many thanks,,
> Sent from my iPad
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

Torben Hoffmann
Erlang Solutions Ltd.
Tel: +45 25 14 05 38
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140603/213ff1f3/attachment.htm>

More information about the erlang-questions mailing list