GEDLIB
1.0
|
GEDLIB is a C++ library for (suboptimally) computing edit distances between graphs using various state-of-the-art methods. GEDLIB allows you to build your graphs via the C++ API or load them from GXL files. Several benchmark datasets are distributed with GEDLIB. For these datasets, GEDLIB provides predefined edit cost functions. You can easily extend GEDLIB by implementing new edit cost functions or new methods for computing the graph edit distance. An extensive Doxygen documentation is availabe here.
The source code of GEDLIB is distributed under the GNU Lesser General Public License. If you want to use GEDLIB in a publication, please refer to the following papers:
GEDLIB uses the following external libraries:
$ brew install clang-omp
.<BOOST_ROOT>
.<GUROBI_ROOT>
and activate your Gurobi licence as described in the Gurobi documentation. If you cannot obtain a licence for Gurobi, you can install GEDLIB without it. In this case, the methods which use mixed integer or linear programming are not available.The following external libraries are distributed with GEDLIB:
For installing them, follow the instructions given in the next paragraph.
After having installed CMake, Doxygen, and OpenMP and having downloaded Boost, execute the script install.py
for installing GEDLIB and the external libraries distributed with GEDLIB:
Use the option --doc
to build the Doxygen documentation, the option --clean
to delete the build directoy and update the makefile before the build, the option --lib gxl
to build the shared library lib/libgxlgedlib.so
for usage with graphs given in the GXL file format, the option --tests all|sspr2018|vldbj2019|tkde2019|unit_tests|ged_env_tests|lsap_solver_tests
to build test executables, and the option --median
to build a GEDLIB implementation of median graph computation for graphs from the Letter
dataset (see Section 7 below). These options require that you also specify the option --boost <BOOST_ROOT>
, where <BOOST_ROOT>
is the path to the directory which contains the Boost sources. Use --debug
if you want to build shared libraries or test executables in debug mode. Specify --gurobi <GUROBI_ROOT>
if you want to install GEDLIB with Gurobi.
Use the option --lib <indentifier>,<UserNodeID>,<UserNodeLabel>,<UserEdgeLabel>
to build GEDLIB as a shared for graphs with custom node ID, node label, and edge label types:
<indentifier>
is a string of lower case letters different from gxl
used for naming the the shared library.<UserNodeID>
is the type of your graphs' node IDs.<UserNodeLabel>
is the type of your graphs' node labels.<UserEdgeLabel>
is the type of your graphs' edge labels.Doing so builds the shared library lib/lib<indentifier>gedlib.so
, which can be used for graphs with node IDs of type <UserNodeID>
, node labels of type <UserNodeLabel>
, and edge labels of type <UserEdgeLabel>
. For example, executing $ python install.py --lib mytypes,int,double,double
builds the shared library lib/libmytypesgedlib.so
for usage with graphs whose node IDs are of type int
and whose node and edge labels are of type double
.
For building an application that uses GEDLIB as a header-only library, it suffices to execute the installation script install.py
without any options. Subsequently, carry out the following steps:
<GEDLIB_ROOT>
<BOOST_ROOT>
<GEDLIB_ROOT>/ext/eigen.3.3.4/Eigen
<GEDLIB_ROOT>/ext/nomad.3.8.1/src
<GEDLIB_ROOT>/ext/nomad.3.8.1/ext/sgtelib/src
<GEDLIB_ROOT>/ext/lsape.5/include
<GEDLIB_ROOT>/ext/libsvm.3.22
<GEDLIB_ROOT>/ext/fann.2.2.0/include
<GUROBI_ROOT>/mac64/include
<GUROBI_ROOT>/linux64/include
<GEDLIB_ROOT>/ext/nomad.3.8.1/lib
<GEDLIB_ROOT>/ext/libsvm.3.22
<GEDLIB_ROOT>/ext/fann.2.2.0/lib
<GUROBI_ROOT>/mac64/lib
<GUROBI_ROOT>/linux64/lib
<GEDLIB_ROOT>/ext/fann.2.2.0/lib/libdoublefann.2.dylib
<GEDLIB_ROOT>/ext/libsvm.3.22/libsvm.so
<GEDLIB_ROOT>/ext/nomad.3.8.1/libnomad.so
<GUROBI_ROOT>/mac64/lib/libgurobi80.so
and <GUROBI_ROOT>/mac64/lib/libgurobi_c++.a
<GUROBI_ROOT>/linux64/lib/libgurobi80.so
and <GUROBI_ROOT>/linux64/lib/libgurobi_c++.a
GUROBI
before including the header src/env/ged_env.hpp
.If you want to build an application that uses GEDLIB as a shared for graphs given as GXL files, make sure that you have installed GEDLIB with the option --lib gxl
. Subsequently, carry out the folowing steps:
<GEDLIB_ROOT>
<BOOST_ROOT>
<GEDLIB_ROOT>/ext/eigen.3.3.4/Eigen
<GEDLIB_ROOT>/ext/nomad.3.8.1/src
<GEDLIB_ROOT>/ext/nomad.3.8.1/ext/sgtelib/src
<GEDLIB_ROOT>/ext/lsape.5/include
<GEDLIB_ROOT>/ext/libsvm.3.22
<GEDLIB_ROOT>/ext/fann.2.2.0/include
<GUROBI_ROOT>/mac64/include
<GUROBI_ROOT>/linux64/include
<GEDLIB_ROOT>/lib
to your link directories.libgxlgedlib.so
.If you want to build an application that uses GEDLIB as a shared library for graphs with custom node ID, node label, and edge label types, make sure that you have installed GEDLIB with the option --lib <indentifier>,<UserNodeID>,<UserNodeLabel>,<UserEdgeLabel>
. Subsequently, carry out the folowing steps:
<GEDLIB_ROOT>/lib
to your link directories.lib<indentifier>gedlib.so
.In your source file, include the header src/env/ged_env.hpp
and create your environment object:
All functionality of GEDLIB is accessible via the environment class ged::GEDEnv
, whose template parameters UserNodeID
, UserNodeLabel
, and UserEdgeLabel
must be set to the types of the node IDs, the node labels, and the edge labels of your graphs. Use the member functions ged::GEDEnv::add_graph()
, ged::GEDEnv::add_node()
, and ged::GEDEnv::add_edge()
, and ged::GEDEnv::set_edit_costs()
for adding graphs and edit costs to the environment. Once you're done with this, call ged::GEDEnv::init()
to initialize the environment.
When you have initialized the environment, you are ready to run the GED methods. To select the method, call ged::GEDEnv::set_method()
. You can then initialize the selected method via ged::GEDEnv::init_method()
, and run it via ged::GEDEnv::run_method()
. Note that most method can be run also without initialization, but doing so typically has a negative impact on both runtime and accuracy. Use the member functions ged::GEDEnv::get_lower_bound()
, ged::GEDEnv::get_upper_bound()
, ged::GEDEnv::get_node_map()
, ged::GEDEnv::get_runtime()
, ged::GEDEnv::get_init_time()
, ged::GEDEnv::get_graph_class()
, and ged::GEDEnv::get_graph_name()
for accessing the results of your GED computations. Use ged::GEDEnv::quasimetric_costs()
to check if your edit costs are quasimetric on the graphs contained in your environment.
If you use GEDLIB with the template parameter UserNodeID
set to ged::GXLNodeID
a.k.a. std::string
and the template parameters UserNodeLabel
and UserEdgeLabel
set to ged::GXLLabel
a.k.a. std::map<std::string,std::string>
, GEDLIB offers additional functionality for loading graphs given in the GXL file format. For those graphs, you do not have to use the member functions ged::GEDEnv::add_graph()
, ged::GEDEnv::add_node()
, and ged::GEDEnv::add_edge()
for adding graphs to your environment. Instead, you can simply load all of them at once by one call to ged::GEDEnv::load_gxl_graphs()
.
If you want to use GEDLIB as a shared library for graphs given as GXL files, make sure that you have installed GEDLIB with the option --lib gxl
. In your source file, you have to define GXL_GEDLIB_SHARED
before including src/env/ged_env.hpp
:
If you want to use GEDLIB as a shared library for graphs with custom node ID, node label, and edge label types, make sure that you have installed GEDLIB with the option --lib <indentifier>,<UserNodeID>,<UserNodeLabel>,<UserEdgeLabel>
. In your source file, you have to define <IDENTIFIER>_GEDLIB_SHARED
before including src/env/ged_env.hpp
, where <IDENTIFIER>
is the upper case transformation of <identifier>
. For example, if you have installed GEDLIB by executing $ python install.py --lib mytypes,int,double,double
, you have to do the following:
For exacmples of how to use GEDLIB, have a look at median/src/median_letter.cpp
and at the .cpp
files contained in the subdirectories of tests/
.
GEDLIB has been used for several research papers. For reproducing the experiments reported in these papers, follow the instructions below.
In order to reproduce the experiments reported in this paper, install GEDLIB with the option --tests sspr2018
. After installation, open a shell and execute the following commands:
After having executed these commands, the results of the experiments are contained in the folder tests/sspr2018/output/
.
In order to reproduce the experiments reported in this paper, install GEDLIB with the options --tests vldbj2019
and --gurobi <GUROBI_ROOT>
. After installation, open a shell and execute the following commands:
After having executed these commands, the results of the experiments are contained in the folder tests/vldbj2019/results/
. For creating TikZ figures and tables that visualize the results, run the script process_results.py
.
GEDLIB comes with several datassets which contain graphs given in the GXL file format. They are contained in the following subdirectories of the directory data/datasets/
:
AIDS
, Fingerprint
, GREC
, Letter
, Mutagenicity
, Protein
: These datasets are taken from the IAM Graph Database. You can use them for scientific work, but are requested to include the following reference to your paper:CMU-GED
: This datasets is taken from the Graph Data Repository for Graph Edit Distance. You can use it for scientific work, but are requested to include the following reference to your paper:acyclic
, alkane
, mao
, pah
: These datasets are taken from GREYC's Chemistry Dataset.S-MOL
: Synthetically generated graphs with varying number of node labels whose structure is similar to the structure of pah
graphs.For each dataset, the directory data/collections/
contains an XML file which lists the contained graphs' GXL files along with their classes. These files match the document type definition data/collections/GraphCollection.dtd
and can hence be used as input for ged::GEDEnv::load_gxl_graphs()
. The Python script data/collections/sample.py
can be used to generate samples of the datasets.
After executing install.py
, the directoy <GEDLIB_ROOT>
has the following internal structure: