1

I'm contemplating an Emacs app that would offer basic graph database capabilities to org-mode. I'd like to write the code myself, a roll your own graph data app. Can anyone direct me to data structures, algorithms for such an undertaking? I know little about graph theory, just the basics. For my endeavor I'd like to store both the org-mode headings inside a single org-mode file as vertices, but also have the option to store a whole org-mode file as single vertex. Each file, each heading vertex will have a unique UUID number in an org-mode PROPERTIES "drawer," which can be understood as a struct for each heading. Edges might be RFD-ish -- essentially "predicate" vertices used as edges. Making a wild guess, I'd say graphs are stored as adjacency lists and not adjacency matrices? Some form of querying should be possible as well.

Any advice appreciated.

147pm
  • 2,137
  • 18
  • 28

2 Answers2

2

So, when I do something like that in org-mode I frequently fall back to its native graphviz support.


# Toggle inline images: c-c c-x c-v
#+BEGIN_SRC dot :results output :file outfilename.png

   digraph "graphname" {

          A [label="foo"];
          B [label="bar", shape="box"];
          C [label="baz", shape="box"];

          A -> B;
          A -> C;
          C -> B;
          
   }

#+END_SRC

#+RESULTS:
[[file:outfilename.png]]

If you need a lot of data, it's not hard to convert a CSV file to a set of graphviz points.

Wes Hardaker
  • 21,735
  • 2
  • 38
  • 69
  • So yes, I've seen that Graphviz uses a sort of adjacency list. Just use their version of AL is your suggestion? – 147pm Jun 15 '21 at 20:21
  • There would certainly be nothing wrong with writing something better! But I've often found that DBs like that quickly get more specific and tricky than simple mechanisms can accomodate. – Wes Hardaker Jun 15 '21 at 20:24
  • I did write a csvtodiag perl script years ago that takes a CSV and spits out a png from graphviz. I still use it randomly. – Wes Hardaker Jun 15 '21 at 20:26
  • The boxed graph DBs have "official" query languages, but the algorithm side of graph theory just has, right, algorithms for getting around in graphs. Part of my motivation is to _not_ have something foreign from theoretic, thus, algorithmic GT. Brain/Roam/Zettelkasten efforts seem oblivious to GT and even Semantic Web. – 147pm Jun 15 '21 at 20:33
0

I'd say this is a good starting point for me. A good discussion. One poster mentioned the very brilliant The Algorithm Design Manual by Steven S. Skiena.

147pm
  • 2,137
  • 18
  • 28