Git Product home page Git Product logo

hypergraph's Introduction

graph


GitHub Workflow Status Crates.io docs.rs

Hypergraph is a data structure library to generate directed hypergraphs.

A hypergraph is a generalization of a graph in which a hyperedge can join any number of vertices.

๐Ÿ“ฃ Goal

This library aims at providing the necessary methods for modeling complex, multiway (non-pairwise) relational data found in complex networks. One of the main advantages of using a hypergraph model over a graph one is to provide a more flexible and natural framework to represent entities and their relationships (e.g. Alice uses some social network, shares some data to Bob, who shares it to Carol, etc).

๐ŸŽ Features

This library enables you to represent:

  • non-simple hypergraphs with two or more hyperedges - with different weights - containing the exact same set of vertices
  • self-loops - i.e., hyperedges containing vertices directed to themselves one or more times
  • unaries - i.e., hyperedges containing a unique vertex

โš—๏ธ Implementation

  • 100% safe Rust
  • Proper error handling
  • Stable indexes assigned for each hyperedge and each vertex
  • Parallelism (with Rayon)

๐Ÿ› ๏ธ Installation

Add this to your Cargo.toml (replace current_version with the latest version of the library):

[dependencies]
hypergraph = "curent_version"

โšก๏ธ Usage

Please read the documentation to get started.

hypergraph's People

Contributors

glyn avatar yamafaktory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hypergraph's Issues

Invalid dot output in integration test

The integration test in tests/test.rs seems to create an invalid dot file (which is normally just printed to the void and not actually used). The output is:

digraph {
    edge [penwidth=0.5, arrowhead=normal, arrowsize=0.5, fontsize=8.0];
    node [color=gray20, fontsize=8.0, fontcolor=white, style=filled, shape=circle];
    rankdir=LR;

    0 [label="Vertex {\l    name: \"d\",\l}\l"];
    1 [label="Vertex {\l    name: \"b\",\l}\l"];
    2 [label="Vertex {\l    name: \"c\",\l}\l"];


     [color="#0c8946", fontcolor="#0c8946", label="\"yup\"\l"];
     [color="#5309a3", fontcolor="#5309a3", label="\"foo_\"\l"];

    0 -> 2 [color="#5b7a07", fontcolor="#5b7a07", label="\"bar\"\l"];
}

It seems to be outputting two edges with connection zero nodes, so just the attributes are being printed? When I run this through dot it errors (because it expected "A -> B" befre the "[color=..."). Is this an error in the dot writing code which is producing vertices without members?

Backend Database

Are there any databases that are supported here? I would like to use this in production.

Packed Compressed Sparse Row (PCSR)

Any aspirations to add PCSR, maybe as an optional graph representation?

From the article:
"...PCSR was orders of magnitude faster for inserts and updates than CSR
and adjacency list while maintaining similar graph traversal times."

http://supertech.csail.mit.edu/papers/WheatmanXu18.pdf

PCSR Code:
https://github.com/wheatman/Packed-Compressed-Sparse-Row

IMHO, space (memory) is easier to solve than the time it takes to generate a graph from a large dataset.

I'm generating currently a number of hyper graphs that usually reach between half a million and 2 million vertexes & edges. My current worst case runtime is in the ballpark of 15 minutes.
These graphs are based on 10% data sample size, the non-sampled data would be more in the ballpark of 30 to 50 million vertices and edges per graph hence the insert time becomes a bit more critical.

Thoughts?

Using dot-writer library

Would you be averse to me refactoring your graphviz code to use my new dot-writer library? Largely for my own selfish reasons (so I can put it through its paces and put it out in the world a bit), but arguably it could make your code more readable, strongly typed and terser?

Happy to do the pull request myself of course (I might have to anyway as it might be missing a function here or there that your dot output needs), and equally understand if you'd like to minimize dependancies / leave things as they are.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.