NuriKit
v0.1.0b2
Toggle main menu visibility
Loading...
Searching...
No Matches
include
nuri
algo
rings.h
Go to the documentation of this file.
1
//
2
// Project NuriKit - Copyright 2023 SNU Compbio Lab.
3
// SPDX-License-Identifier: Apache-2.0
4
//
5
#ifndef NURI_ALGO_RINGS_H_
6
#define NURI_ALGO_RINGS_H_
7
9
#include <memory>
10
#include <utility>
11
#include <vector>
13
14
#include "
nuri/core/molecule.h
"
15
16
namespace
nuri
{
17
using
Rings
= std::vector<std::vector<int>>;
18
36
extern
std::pair<Rings, bool>
find_all_rings
(
const
Molecule
&mol,
37
int
max_size = -1);
38
56
extern
std::pair<Rings, bool>
find_all_rings
(
const
Substructure
&sub,
57
int
max_size = -1);
58
76
extern
std::pair<Rings, bool>
find_all_rings
(
const
ConstSubstructure
&sub,
77
int
max_size = -1);
78
79
namespace
internal {
80
template
<
class
MoleculeLike>
81
struct
FindRingsCommonData;
82
}
// namespace internal
83
114
template
<
class
MoleculeLike>
115
class
RingSetsFinder
{
116
public
:
123
explicit
RingSetsFinder
(
const
MoleculeLike &mol,
int
max_size = -1);
124
125
RingSetsFinder
(
const
RingSetsFinder
&) =
delete
;
126
RingSetsFinder
&
operator=
(
const
RingSetsFinder
&) =
delete
;
127
RingSetsFinder
(
RingSetsFinder
&&) noexcept;
128
RingSetsFinder
&operator=(
RingSetsFinder
&&) noexcept;
129
130
~
RingSetsFinder
() noexcept;
131
137
Rings
find_relevant_rings
() const;
138
146
Rings
find_sssr
() const;
147
148
private:
149
const MoleculeLike *mol_;
150
std::unique_ptr<internal::FindRingsCommonData<MoleculeLike>> data_;
151
};
152
153
template <class MoleculeLike>
154
RingSetsFinder
(const MoleculeLike &,
int
) ->
RingSetsFinder
<MoleculeLike>;
155
156
extern template class
RingSetsFinder
<
Molecule
>;
157
extern template class
RingSetsFinder
<
Substructure
>;
158
extern template class
RingSetsFinder
<
ConstSubstructure
>;
159
174
inline
Rings
find_relevant_rings
(const
Molecule
&mol,
int
max_size = -1) {
175
return
RingSetsFinder
(mol, max_size).find_relevant_rings();
176
}
177
192
inline
Rings
find_relevant_rings
(
const
Substructure
&sub,
int
max_size = -1) {
193
return
RingSetsFinder
(sub, max_size).find_relevant_rings();
194
}
195
210
inline
Rings
find_relevant_rings
(
const
ConstSubstructure
&sub,
211
int
max_size = -1) {
212
return
RingSetsFinder
(sub, max_size).find_relevant_rings();
213
}
214
231
inline
Rings
find_sssr
(
const
Molecule
&mol,
int
max_size = -1) {
232
return
RingSetsFinder
(mol, max_size).find_sssr();
233
}
234
251
inline
Rings
find_sssr
(
const
Substructure
&sub,
int
max_size = -1) {
252
return
RingSetsFinder
(sub, max_size).find_sssr();
253
}
254
271
inline
Rings
find_sssr
(
const
ConstSubstructure
&sub,
int
max_size = -1) {
272
return
RingSetsFinder
(sub, max_size).find_sssr();
273
}
274
}
// namespace nuri
275
276
#endif
/* NURI_ALGO_RINGS_H_ */
nuri::Molecule
Read-only molecule class.
Definition
molecule.h:943
nuri::RingSetsFinder
Wrapper class of the common routines of find_sssr() and find_relevant_rings().
Definition
rings.h:115
nuri::RingSetsFinder::RingSetsFinder
RingSetsFinder(const MoleculeLike &mol, int max_size=-1)
Construct a new Rings Finder object.
nuri::RingSetsFinder::operator=
RingSetsFinder & operator=(const RingSetsFinder &)=delete
nuri::RingSetsFinder::find_relevant_rings
Rings find_relevant_rings() const
Find the relevant rings of the molecule.
nuri::RingSetsFinder::find_sssr
Rings find_sssr() const
Find the SSSR of the molecule.
nuri::RingSetsFinder::RingSetsFinder
RingSetsFinder(const RingSetsFinder &)=delete
nuri::RingSetsFinder::RingSetsFinder
RingSetsFinder(RingSetsFinder &&) noexcept
molecule.h
nuri
Definition
crdgen.h:16
nuri::find_all_rings
std::pair< Rings, bool > find_all_rings(const Molecule &mol, int max_size=-1)
Find all elementary cycles in the molecular graph.
nuri::Rings
std::vector< std::vector< int > > Rings
Definition
rings.h:17
nuri::find_relevant_rings
Rings find_relevant_rings(const Molecule &mol, int max_size=-1)
Find union of the all SSSRs in the molecular graph.
Definition
rings.h:174
nuri::Substructure
internal::Substructure< false > Substructure
Definition
molecule.h:928
nuri::ConstSubstructure
internal::Substructure< true > ConstSubstructure
Definition
molecule.h:929
Generated by
1.17.0