Data Structures | |
struct | primitive::Vertex |
This is a collection of elements, for each point, required for graph traversal. More... | |
struct | primitive::Graph |
This is a per-frame object, containing all the vertices for the particular frame, along with the vector of rings generated. More... | |
Functions | |
std::vector< std::vector< int > > | primitive::ringNetwork (std::vector< std::vector< int >> nList, int maxDepth) |
Graph | primitive::populateGraphFromNListID (molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< std::vector< int >> neighHbondList) |
Graph | primitive::populateGraphFromIndices (std::vector< std::vector< int >> nList) |
Graph | primitive::restoreEdgesFromIndices (Graph *fullGraph, std::vector< std::vector< int >> nList) |
Graph | primitive::countAllRingsFromIndex (std::vector< std::vector< int >> neighHbondList, int maxDepth) |
Creates a vector of vectors of all possible rings. More... | |
Graph | primitive::removeNonSPrings (Graph *fullGraph) |
Removes the non-SP rings, using the Franzblau shortest path criterion. More... | |
int | primitive::findRings (Graph *fullGraph, int v, std::vector< int > *visited, int maxDepth, int depth, int root=-1) |
Main function that searches for all rings. More... | |
int | primitive::shortestPath (Graph *fullGraph, int v, int goal, std::vector< int > *path, std::vector< int > *visited, int maxDepth, int depth=1) |
Calculates the shortest path. More... | |
Graph | primitive::clearGraph (Graph *currentGraph) |
Function for clearing vectors in Graph after multiple usage. More... | |
Variables | |
int | primitive::Vertex::atomIndex |
std::vector< int > | primitive::Vertex::neighListIndex |
This is the index according to pointCloud. More... | |
bool | primitive::Vertex::inGraph |
std::vector< Vertex > | primitive::Graph::pts |
std::vector< std::vector< int > > | primitive::Graph::rings |
primitive::Graph primitive::clearGraph | ( | Graph * | currentGraph | ) |
Function for clearing vectors in Graph after multiple usage.
Function for clearing Graph if it is already filled. This should be called before every frame is read in.
[out] | currentGraph | The cleared Graph |
Definition at line 444 of file franzblau.cpp.
primitive::Graph primitive::countAllRingsFromIndex | ( | std::vector< std::vector< int >> | neighHbondList, |
int | maxDepth | ||
) |
Creates a vector of vectors of all possible rings.
Get all possible rings (only atom indices, not IDs). The input neighbour list is in terms of indices. All possible rings (including non-SP) rings are generated using a recursive backtracking algorithm. This function calls the following functions internally:
[in] | neighHbondList | Row-ordered neighbour list by atom index (not ID). |
[in] | maxDepth | The maximum depth upto which rings will be searched. This means that rings larger than maxDepth will not be generated. |
Definition at line 64 of file franzblau.cpp.
int primitive::findRings | ( | Graph * | fullGraph, |
int | v, | ||
std::vector< int > * | visited, | ||
int | maxDepth, | ||
int | depth, | ||
int | root = -1 |
||
) |
Main function that searches for all rings.
All possible rings are searched for in this function, which recursively calls itself. The rings are 'grown' from the root node (which is the first vertex) using the backtracking algorithm. When it is first called (before the root node has been assigned), root is a dummy value (which is equal to -1, a value that can never be legitimate).
[in,out] | fullGraph | Graph object containing the vertices (and the neighbour lists). Vertices may be 'removed' from the Graph. |
[in] | v | The current vertex being visited or checked. It is added to the list of all vertices visited. |
[in] | visited | A vector containing a list of the vertices visited for book-keeping. If the current visited vector fulfills the condition for being a ring, it is added to the rings vector of vector in the Graph. |
[in] | maxDepth | The maximum depth upto which rings will be searched. This means that rings larger than maxDepth will not be generated. |
[in] | depth | The current depth. When this function is called for the first time from primitive::countAllRingsFromIndex, the depth is initialized to 0. When the depth is greater than or equal to maxDepth, the function exits. |
[in] | root | The first vertex, from which the current visited vector (candidate ring) is being grown. This is initialized to a dummy value of -1, when it is called from primitive::countAllRingsFromIndex. |
Definition at line 116 of file franzblau.cpp.
primitive::Graph primitive::populateGraphFromIndices | ( | std::vector< std::vector< int >> | nList | ) |
Creates a graph object and fills it with the information from a neighbour list of INDICES NOT ATOM IDs created before. NOTE: the neighbourListIndex contains the indices and NOT the atom IDs as in the neighbour list
Fills a Graph object with information from the PointCloud and the neighbour list. The indices in the neighbour list in the Vertex object are NOT the atom IDs (they are the atom indices according to the input PointCloud). The input neighbour list is by index NOT atom IDs. Otherwise, this function does the same thing as primitive::populateGraphFromNListID. The only difference is that this function takes the neighbour list BY INDEX.
[in] | nList | The row-ordered neighbour list, containing atom indices (according to the input PointCloud). |
Definition at line 248 of file franzblau.cpp.
primitive::Graph primitive::populateGraphFromNListID | ( | molSys::PointCloud< molSys::Point< double >, double > * | yCloud, |
std::vector< std::vector< int >> | neighHbondList | ||
) |
Creates a graph object and fills it with the information from a neighbour list and pointCloud created before. NOTE: the neighbourListIndex contains the indices and NOT the atom IDs as in the neighbour list
Fills a Graph object with information from the PointCloud and the neighbour list. The indices in the neighbour list in the Vertex object are NOT the atom IDs (they are the atom indices according to the input PointCloud). The input neighbour list is by atom ID.
[in] | yCloud | The input PointCloud. |
[in] | neighHbondList | The row-ordered neighbour list, containing atom IDs, and not the atom indices. |
Definition at line 192 of file franzblau.cpp.
primitive::Graph primitive::removeNonSPrings | ( | primitive::Graph * | fullGraph | ) |
Removes the non-SP rings, using the Franzblau shortest path criterion.
Removes non-SP rings (according to the Franzblau shortest path criterion) from the rings vector of vectors member n the Graph object. The rings vector of vectors contains indices and NOT atom IDs. This function calls primitive::shortestPath internally to calculate the shortest path.
[in] | fullGraph | The Graph object for the current frame. This also contains the rings vector of vectors, which has all possible rings (possibly inclding non-SP rings). |
Definition at line 307 of file franzblau.cpp.
primitive::Graph primitive::restoreEdgesFromIndices | ( | Graph * | fullGraph, |
std::vector< std::vector< int >> | nList | ||
) |
Re-fills the neighbour lists of a graph object from a neighbour list of INDICES NOT ATOM IDs created before. NOTE: the neighbourListIndex contains the indices and NOT the atom IDs as in the neighbour list
Re-fills the neighbour lists of a Graph object from a row-ordered neighbour list (which is BY INDEX not IDs). Some vertices may have been removed while rings were generated using the backtracking algorithm (primitive::findRings). Also, the indices in the neighbour list in the Vertex object are not the atom IDs.
[in] | fullGraph | The Graph object for the current frame. The neighbour lists of component Vertex objects may have been depleted. |
[in] | nList | The row-ordered neighbour list, containing atom indices (according to the input PointCloud). |
Definition at line 283 of file franzblau.cpp.
std::vector< std::vector< int > > primitive::ringNetwork | ( | std::vector< std::vector< int >> | nList, |
int | maxDepth | ||
) |
Returns a vector of vectors containing the rings (of all sizes), by atom index, given the neighbour list also by index (preferably the hydrogen-bonded neighbour list). Internally uses the Graph and Vertex objects.
The vector of vector of rings, by index, is returned, given a neighbour list (also by index) and the maximum depth upto which rings will be searched, using the Franzblau algorithm for shortest paths. This function is registered in Lua and exposed to the user. This internally calls the functions:
[in] | nList | Row-ordered neighbour list by index (and NOT the atom ID) |
[in] | maxDepth | The maximum depth upto which rings will be searched. This means that rings larger than maxDepth in length will not be generated. |
Definition at line 32 of file franzblau.cpp.
int primitive::shortestPath | ( | Graph * | fullGraph, |
int | v, | ||
int | goal, | ||
std::vector< int > * | path, | ||
std::vector< int > * | visited, | ||
int | maxDepth, | ||
int | depth = 1 |
||
) |
Calculates the shortest path.
Calculates the shortest path for a particular ring. This function uses recursion.
[in] | fullGraph | The Graph object for the current frame. |
[in] | v | The current vertex being checked. |
[in] | goal | The first element of the candidate ring being checked (the root node). |
[in] | path | The path or length of the visited points (This basically contains all the indices in the visited vector, excluding the current vertex). |
[in] | visited | This vector contains the indices of the vertices visited or checked (for book-keeping). |
[in] | maxDepth | The maximum depth or maximum length of the rings. |
[in] | depth | The current depth. When this function is called from primitive::removeNonSPrings, the depth is initialized as 0. |
Definition at line 397 of file franzblau.cpp.
int primitive::Vertex::atomIndex |
Definition at line 91 of file franzblau.hpp.
bool primitive::Vertex::inGraph |
Contains the INDICES (not the atomIDs) of the neighbouring vertices
Definition at line 94 of file franzblau.hpp.
std::vector<int> primitive::Vertex::neighListIndex |
This is the index according to pointCloud.
Definition at line 92 of file franzblau.hpp.
std::vector<Vertex> primitive::Graph::pts |
Definition at line 109 of file franzblau.hpp.
std::vector<std::vector<int> > primitive::Graph::rings |
Collection of vertices. The index of each should be the same as that in pointCloud
Definition at line 112 of file franzblau.hpp.