40 /** Abstract graph and tree data structures, plus generic graph algorithms
41 * \ingroup mrpt_graphs_grp
42 */
43namespace graphs
44 {
45using namespace mrpt::math;
46
47 /** Algorithms for finding the min-normalized-cut of a weighted undirected graph.
48 * Two static methods are provided, one for bisection and the other for
49 * iterative N-parts partition.
50 * It is based on the Shi-Malik method, proposed for example in:<br><br>
51 * <code>J. Shi and J. Malik, "Normalized Cuts and Image Segmentation,"IEEE Transactions on Pattern Analysis and Machine Intelligence, vol.22, no.8, pp. 888-905, Aug. 2000.</code><br>
57 /** Performs the spectral recursive partition into K-parts for a given graph.
58 * The default threshold for the N-cut is 1, which correspond to a cut equal
59 * of the geometric mean of self-associations of each pair of groups.
60 *
61 * \param in_A [IN] The weights matrix for the graph. It must be a square matrix, where element W<sub>ij</sub> is the "likelihood" between nodes "i" and "j", and typically W<sub>ii</sub> = 1.
62 * \param out_parts [OUT] An array of partitions, where each partition is represented as a vector of indexs for nodes.
63 * \param threshold_Ncut [IN] If it is desired to use other than the default threshold, it can be passed here.
64 * \param forceSimetry [IN] If set to true (default) the elements W<sub>ij</sub> and W<sub>ji</sub> are replaced by 0.5·(W<sub>ij</sub>+W<sub>ji</sub>). Set to false if matrix is known to be simetric.
65 * \param useSpectralBisection [IN] If set to true (default) a quick spectral bisection will be used. If set to false, a brute force, exact finding of the min-cut is performed.
66 * \param recursive [IN] Default=true, recursive algorithm for finding N partitions. Set to false to force 1 bisection as maximum.
67 * \param minSizeClusters [IN] Default=1, Minimum size of partitions to be accepted.
68 *
69 * \sa CMatrix, SpectralBisection
70 *
71 * \exception Throws a std::logic_error if an invalid matrix is passed.
82 /** Performs the spectral bisection of a graph. This method always perform
83 * the bisection, and a measure of the goodness for this cut is returned.
84 *
85 * \param in_A [IN] The weights matrix for the graph. It must be a square matrix, where element W<sub>ij</sub> is the "likelihood" between nodes "i" and "j", and typically W<sub>ii</sub> = 1.
86 * \param out_part1 [OUT] The indexs of the nodes that fall into the first group.
87 * \param out_part2 [OUT] The indexs of the nodes that fall into the second group.
88 * \param out_cut_value [OUT] The N-cut value for the proposed cut, in the range [0-2].
89 * \param forceSimetry [IN] If set to true (default) the elements W<sub>ij</sub> and W<sub>ji</sub> are replaced by 0.5·(W<sub>ij</sub>+W<sub>ji</sub>). Set to false if matrix is known to be simetric.
90 *
91 * \sa CMatrix, RecursiveSpectralPartition
92 *
93 * \exception Throws a std::logic_error if an invalid matrix is passed.
102 /** Performs an EXACT minimum n-Cut graph bisection, (Use CGraphPartitioner::SpectralBisection for a faster algorithm)
103 *
104 * \param in_A [IN] The weights matrix for the graph. It must be a square matrix, where element W<sub>ij</sub> is the "likelihood" between nodes "i" and "j", and typically W<sub>ii</sub> = 1.
105 * \param out_part1 [OUT] The indexs of the nodes that fall into the first group.
106 * \param out_part2 [OUT] The indexs of the nodes that fall into the second group.
107 * \param out_cut_value [OUT] The N-cut value for the proposed cut, in the range [0-2].
108 * \param forceSimetry [IN] If set to true (default) the elements W<sub>ij</sub> and W<sub>ji</sub> are replaced by 0.5·(W<sub>ij</sub>+W<sub>ji</sub>). Set to false if matrix is known to be simetric.
109 *
110 * \sa CMatrix, RecursiveSpectralPartition
111 *
112 * \exception Throws a std::logic_error if an invalid matrix is passed.
129 /** If set to true (default=false), each eigenvector computed (and the laplacian of the adj. matrix) will be saved to files "DEBUG_GRAPHPART_eigvectors_xxx" and "DEBUG_GRAPHPART_laplacian_xxx", respectively.