Open gmgu opened 4 years ago
We need to write a file header for each file. For example,
//***************************************************************************
// This file is part of the graph isomorphism algorithm.
// Copyright by Geonmo Gu, Yehyun Nam, and Kunsoo Park
//
// Name: backtrack.cpp
// Author: Geonmo Gu
// Version
// August 20, 2020: the first stable version. (version 1.0)
//***************************************************************************
Also, we need to write comments for each function
//SEARCH for an embedding of aG1 in aG2
//RETURN true if there is an embedding, false otherwise
bool Backtrack::run(Coloring* aColoring, Graph* aG1, Graph* aG2, int32_t aNumTreeNode)
//parameters: [stable coloring of aG1], [aG1], [aG2], [the number of tree nodes in aG1]
//SEARCH for an embedding of aG1 in aG2
//RETURN true if there is an embedding, false otherwise
bool run(Coloring*, Graph*, Graph*, int32_t);
We need a coding convention in some parts of our source code.
I recommend to avoid prefix or postfix operator inside an array or a function. For example, avoid the following command. https://github.com/SNUCSE-CTA/GI/blob/35bdcbb72667ee86fe2497c96164ead4efdfb8e6/src/refine.cpp#L286 Instead, I recommend to split it into two lines as follows.
splitCell[numSplitCell] = c;
++numSplitCell
I recommend to add a single blank line between each logical blocks. For example, consider the following code. https://github.com/SNUCSE-CTA/GI/blob/35bdcbb72667ee86fe2497c96164ead4efdfb8e6/src/refine.cpp#L228 It can be rewritten like
memset(markCell, 0, sizeof(long long) * numNode);
I recommend to state a command in the next line of its conditional statement (not in the same line). For example, https://github.com/SNUCSE-CTA/GI/blob/35bdcbb72667ee86fe2497c96164ead4efdfb8e6/src/refine.cpp#L225 I think it is better to place break; under the if statement.
I just skimmed the source code, so there can be more issues about the coding convention. Perhaps we can write a document of the coding convention and update it as we develop this project...