CBGfinder is a software for given graphs to find subgraphs (any subgraphs, connected subgraphs, spanning subgraphs or induced subgraphs) accepted by an automaton.

## 1. Download Source Code

CBGfinder.zip

## 2. Compile

CBGfinder was developed with Visual C++ on Windows. However, it can be compiled by g++ on linux.

If you have g++ on linux, try:

$ **g++ -o CBGfinder -std=c++11 sample_main.cpp CBGfinder.cpp**

## 3. Run

The sample program reads graphs in an SDF file (or a MOL file for a single graph) and outputs results in SDF files (accept.sdf, reject.sdf and tw_big.sdf).

To find a longest path in each sample graph, type:

$ **CBGfinder -a automaton_path.txt -max sample.sdf**

To find a longest cycle in each sample graph, type:

$ **CBGfinder -a automaton_cycle.txt -max sample.sdf**

To find a benzene ring in each sample graph, type:

$ **CBGfinder -a automaton_benzene.txt sample.sdf**

To display an SDF file, we recommend to use MarvinView developed by ChemAxon.

To draw a graph in a MOL file, we recommend to use MarvinSketch developed by ChemAxon or MolTouch developed in our laboratory.