Git Product home page Git Product logo

sb-graph's Introduction

Set-Based Graph Library

Set-based graphs (SB-Graphs) are graphs in which the vertices and edges are grouped in sets allowing sometimes a compact representation. When the compact representation is feasible, it is possible to develop new versions of traditional algorithms that take advantage of the structure of SB-Graphs, with a cost that is independent on the size of the sets of vertices and edges. Current algorithms for SB-Graphs:

  • Connected Components
  • Matching
  • Strongly Connected Components (SCC)

This library defines data structures to represent SB-Graphs, and implements the aforementioned algorithms. The related publications can be used as documentation of the code.

This new approach was used in the flatter and causalization stage of the Modelica compiler, ModelicaCC (https://github.com/CIFASIS/modelicacc). Nevertheless, many fields could benefit of its use.

Related Publications

[1] Denise Marzorati, Joaquin Fernández, Ernesto Kofman. Connected Components in Undirected Set--Based Graphs. Applications in Object--Oriented Model Manipulation Applied Mathematics and Computation, Volume 418, 2022, 126842,ISSN 0096-3003, https://doi.org/10.1016/j.amc.2021.126842.

[2] Ernesto Kofman, Joaquín Fernández, Denise Marzorati. Compact sparse symbolic Jacobian computation in large systems of ODEs Applied Mathematics and Computation, Volume 403, 2021, 126181, ISSN 0096-3003, https://doi.org/10.1016/j.amc.2021.126181.

[3] Pablo Zimmermann, Joaquin Fernandez, Ernesto Kofman. Set-based graph methods for fast equation sorting in large DAE systems EOOLT '19: Proceedings of the 9th International Workshop on Equation-based Object-oriented Modeling Languages and Tools 2019

Installation

These are generic installation instructions.

Dependencies

In order to be able to install and compile SBG Library, the following dependencies must be installed:

  • autoconf 2.69 (avoid 2.71)
  • boost1.81 (or later)
  • cmake
  • g++
  • make
  • doxygen (optional)

Basic Installation

The simplest way to compile this package is:

  1. cd to the directory containing the package's source code and type autoconf to generate the configuration scripts.

  2. Type ./configure to run the configuration script.

  3. Type make to compile the library libsbgraph.a

  4. Type sudo make install to install the library and header files in the default installation folders. The default installation folders are:

    • prefix=/usr/local
    • includedir=/usr/local/include
    • libdir=/usr/local/lib
  5. You can remove the generated library and object files from the source code directory by typing make clean.

Makefile options

The makefile script accepts the following options:

  • MODE = <Debug|Release> When set to Debug (default), adds the compiler's debug flags.

  • prefix = Set the prefix installation path, default: /usr/local.

  • exec_prefix = Set the binaries installation path, default: /usr/local.

  • includedir = Set the header installation path, default: /usr/local/incldue.

  • libdir = Set the library installation path, default: /usr/local/lib.

Makefile targets

The makefile script accepts the following targets:

  • test: Builds and run integration and unit tests.

  • doc: Builds the documentation.

SBG library

The SBG library is composed by four main modules:

  • ast

  • parser

  • eval

  • sbg

The first three were developed to allow for more user-friendly input. The first three were developed to allow for more user-friendly input, and the last one contains all the logical implementation of structures and operations.

Examples:

Examples of SBG programs are presented in the /test folder with the '.test' extension. The bin/sbg-parser and bin/sbg-eval binaries accept these files as their input. Also, the make test command in the root directory will execute all of the existing tests.

Licensing

Please see the file called LICENSE.

Bug Reporting

Report bugs to: [email protected] or [email protected]

sb-graph's People

Contributors

joaquinffernandez avatar kalashnikovni avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

kalashnikovni

sb-graph's Issues

Fix Eval System tests.

Currently disable pw_map and map eval system tests because they are failing consistently. Either fix or update them so we can add them back to the test-suite.

Real's representation

The current implementation of maps uses double to represent real numbers. This can be a problem when working with big numbers (main application of ModelicaCC), where the distribution of floating point numbers is sparse. With such numbers, the application of a map to a domain leads to an incorrect result.

Suggestion: use fractional numbers. Check if BOOST supports them.

Canonize sets, maps

Currently, sets are implemented without order. We think that canonizing them through order can be an improvement to the cost of the operations.

SCC Algorithm

Develop an SCC algorithm for SBG, using minReach function.

SBG parser

Currently, the SBG library doesn't count with a parser, which leads to a huge test suit (GraphTest).

It would be nice to define DSL for intervals, multi-intervals, etc. Then, define its parser. A big bonus would be a graphic interface to draw graphs.

SBG refactor

The current implementation makes use of the boost graph library to represent SBG. In the implementation of algorithms we use the defined maps (ignoring the boost module) or else we have to make two calls (one to boost and another to the SBG functions).
Also many modules of structures such as intervals, multi_intervals, etc. were in an experimental stage, and as such their implementation is pretty messy.
A complete refactor of these modules is proposed, adding the optimizations described in iss-18.

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.