Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/TakehideSoh/SAF
18 January 2026, 11:53:51 UTC
  • Code
  • Branches (4)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/dev
    • refs/heads/main
    • refs/tags/v1.0-cmsb2023
    • refs/tags/v1.1-CMSB2023
    • d26cc9f94a4f79c046ee0cdd3a127a44f7b443b6
    No releases to show
  • 83aaea6
  • /
  • bdd_minisat_all-1.0.2
  • /
  • obdd.h
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:2e1b60bd94ae22b0dcb91874fe0d626a1fb4ae85
origin badgedirectory badge
swh:1:dir:e4b48dfb354d10699e262001c0cd6416edb3f793
origin badgerevision badge
swh:1:rev:d26cc9f94a4f79c046ee0cdd3a127a44f7b443b6
origin badgesnapshot badge
swh:1:snp:d3fcf0e446f52630e867f11dee4c2c828bf46951

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: d26cc9f94a4f79c046ee0cdd3a127a44f7b443b6 authored by TakehideSoh on 23 June 2023, 07:02:26 UTC
Merge pull request #2 from TakehideSoh/dev
Tip revision: d26cc9f
obdd.h
/** \file     obdd.h
 *  \brief    OBDD implementation, where OBDDs mean BDDs that are ordered, but need not be reduced.
 *  \author   Takahisa Toda
 *  \note     For details of BDDs (Binary Decision Diagrams), see
 *  - Bryant, R.E.: Graph-Based algorithm for Boolean function manipulation, IEEE Trans. Comput., Vol.35, pp.677-691 (1986)
 *  - Knuth, D.E.: The Art of Computer Programming Volume 4a, Addison-Wesley Professional, New Jersey, USA (2011) .
 */
#ifndef OBDD_H
#define OBDD_H

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <stdint.h>

#ifdef GMP
#include <gmp.h>
#endif

/*---------------------------------------------------------------------------*/
/* Type declarations                                                         */
/*---------------------------------------------------------------------------*/

typedef struct obdd_st obdd_t;

/** \brief  binary decidion diagram node*/
struct obdd_st {
  int              v;      //!< assigned label
  intptr_t       aux;      //!< an auxiliary field (of pointer size), which is introduced in order to facilitate implementation.
  struct obdd_st  *lo;      //!< low arc
  struct obdd_st  *hi;      //!< hi arc
  struct obdd_st  *nx;      //!< 
};


extern obdd_t *top_node; //!< top terminal node
extern obdd_t *bot_node; //!< bottom terminal node

/*---------------------------------------------------------------------------*/
/* Function prototypes                                                       */
/*---------------------------------------------------------------------------*/


/* \brief   Obtain obdd node with specified field.
 * \param   v   variable index, which must be a non-zero positive interger.
 * \param   lo  lo child
 * \param   hi  hi child
 * \return  pointer to an obtained node
 */
extern obdd_t* obdd_node(int v, obdd_t* lo, obdd_t* hi);


/* \brief For all nodes in p, if their lo or hi field is NULL, set bottom terminal.
 * \return the number of nonterminal nodes
 * \note
 * - Since obdd constructed by sat solver may be imcomplete, call this function before applying other functions.
 * - That is, after this function finishes, all nodes below p are linked from p by nx field, which are assumed in executing other obdd function for the sake of efficiency.
 * - If it is called for different obdds, all nodes in the last obdd are linked, while those in other obdds may not! If necessary, call this function again.
 */
extern uintmax_t obdd_complete(obdd_t* p);


/* \brief Count the number of all nodes in p except for terminal nodes.
 */
extern uintmax_t obdd_size(obdd_t* p);

/* \brief Make a file in dot format that represents the graph structure of p.
 * \param n     the number of variables
 * \param p     root node of obdd
 * \param out   pointer to output file, which must be open in write mode.
 * \return ST_SUCCESS if successful; ST_FAILURE, otherwise.
 * \note    See www.graphviz.org/ .
 */
extern int obdd_to_dot(int n, obdd_t* p, FILE *out);


/* \brief Count the number of paths from the root to the top terminal in p, which corresponds to the number of total satisfying assignments, i.e. solutions.
 * \param n     the number of variables
 * \param p     root of obdd
 * \return the computed number
 */
extern intptr_t obdd_nsols(int n, obdd_t* p);


#ifdef GMP
/* \brief GMP version of obdd_nsols: this is useful if the number of solutions is too large to count.
 * \param result the computed number is stored here.
 * \param n     the number of variables
 * \param p     root of obdd
 * \note see The GNU MP Bignum Library: https://gmplib.org/ .
 */
extern void obdd_nsols_gmp(mpz_t result, int n, obdd_t* p);
#endif


/* \brief Compute all partial assignments by traversing obdd.
 * \param out   pointer to output file, which must be open in write mode.
 * \param n     the number of variables
 * \param p     root of obdd
 * \return The number of assignments.
 * \note
 * - when this function is called several times, results are appended to output file.
 * - Please take care that a huge number of assignments may be generated.
 */
extern uintptr_t obdd_decompose(FILE *out, int n, obdd_t* p);


/* \brief   Return the total number of obdd nodes that have been created so far.
 */
extern uintmax_t obdd_nnodes(void); 


/* \brief Delete p and all non-terminal nodes below p. 
 */
extern void obdd_delete_all(obdd_t* p);


// v field must be accessed by this function, because it may have negative value during traversal of obdd.
static inline int obdd_label(obdd_t* p)
{
  return abs(p->v);
}


// v field must be accessed by this function, because it may have negative value during traversal of obdd.
static inline void obdd_setlabel(int v, obdd_t* p)
{
  p->v = abs(v);
}


/* \brief   Obtain the top terminal node.
 */
static inline obdd_t* obdd_top()
{
    if(top_node == NULL)
        top_node = obdd_node(INT_MAX, NULL, NULL);

    return top_node;
}


/* \brief   Obtain the bottom terminal node.
 */
static inline obdd_t* obdd_bot()
{
    if(bot_node == NULL)
        bot_node = obdd_node(INT_MAX, NULL, NULL);

    return bot_node;
}


/* \brief Decide if p is a terminal node.
 * \return true if p is a terminal node; false, otherwise.
 */
static inline int obdd_const(obdd_t* p)
{
    return p == obdd_bot() || p == obdd_top();
}
#endif /*OBDD_H*/

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API