Hypergraph in database

1.4k Views Asked by At

I've started with a project where I need to present my data as hypergraph. The idea is:
I have sequence of elements (vertices) and I can mix them (create edge). Every edge can be mixed with elements. The idea looks like this:

                result
                 /
            mix(1+2) +
            element 3
                |
                +---------+
                |         |
             element      |
             1+2(mix)  element
               /|         3
              / |
             /  |
            /   |
        element |
           1    |
             element
                2

I need to know all mixes and save the result. After I have enough data I'll need to analyze it and when user picks 3 or more elements I'll need to show all the results he can get.

I need to build a db structure to support graph algorithms and it must work fast. Which type of database will solve this and how I should build the structure? Do I need to use graph database, sql or NoSql?
I'll appreciate any ideas or examples.

2

There are 2 best solutions below

2
On BEST ANSWER

It depends on what type of queries you want to run. But for graph oriented exploration (read graph traversals) a graph database is what you need.

To support hyper-edges in any graph-databases, the trick is to create a node with a type: hyperedge and link nodes to it exactly like you did in your figure.

The hyperedge object can have child nodes or hyperedge objects (the results of a query).

To implement this, the fastest graph database I know is Sparksee written in C++ with .Net, Java, Python, Obj-C bindings. It is free for academic usage (you will need a serial anyways.)

Otherwise, you can use Neo4j which is the most popular graph database (free for open-source).

If the scale of your data is very big, you maybe want to explore Titan, and open-source graph database on top of Cassandra, or HBase (2 NoSQL databases).

0
On

You could try HypergraphDB http://www.hypergraphdb.org/.

It is a simple Java library (jar file to add to your project) and uses an embedded database as backend, it permits you to work with graphs without installing a specific background running server.