RDKit: Sort.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Sort.h
Go to the documentation of this file.
1//
2//
3// Copyright (C) 2020 Schrödinger, LLC
4//
5// @@ All Rights Reserved @@
6// This file is part of the RDKit.
7// The contents are covered by the terms of the BSD license
8// which is included in the file license.txt, found at the root
9// of the RDKit source tree.
10//
11#pragma once
12
13#include <vector>
14#include "Priority.h"
15
16namespace RDKit {
17namespace CIPLabeler {
18
19class SequenceRule;
20class Edge;
21class Node;
22
23/**
24 * A simple insertion sort for substituents. The number of substituents is not
25 * likely to be large enough that doing a merge sort would make a difference
26 *
27 */
28 class Sort {
29 public:
30 Sort(const SequenceRule *comparator);
31
32 Sort(std::vector<const SequenceRule *> comparators);
33
34 const std::vector<const SequenceRule *> &getRules() const;
35
36 Priority prioritize(const Node *node, std::vector<Edge *> &edges,
37 bool deep = true) const;
38
39 std::vector<std::vector<Edge *>> getGroups(
40 const std::vector<Edge *> &sorted) const;
41
42 private:
43 const std::vector<const SequenceRule *> d_rules;
44
45 int compareSubstituents(const Node *node, const Edge *a, const Edge *b,
46 bool deep) const;
47}; // namespace CIPLabeler
48
49} // namespace CIPLabeler
50} // namespace RDKit
Priority.h
RDKit::CIPLabeler::Edge
Definition Edge.h:23
RDKit::CIPLabeler::Node
Definition Node.h:27
RDKit::CIPLabeler::Priority
Definition Priority.h:21
RDKit::CIPLabeler::SequenceRule
Definition SequenceRule.h:36
RDKit::CIPLabeler::Sort::getRules
const std::vector< const SequenceRule * > & getRules() const
RDKit::CIPLabeler::Sort::getGroups
std::vector< std::vector< Edge * > > getGroups(const std::vector< Edge * > &sorted) const
RDKit::CIPLabeler::Sort::Sort
Sort(std::vector< const SequenceRule * > comparators)
RDKit::CIPLabeler::Sort::prioritize
Priority prioritize(const Node *node, std::vector< Edge * > &edges, bool deep=true) const
RDKit::CIPLabeler::Sort::Sort
Sort(const SequenceRule *comparator)
RDKit::CIPLabeler
Definition CIPLabeler.h:27
RDKit
Std stuff.
Definition Abbreviations.h:19