Partly doxygenise the tarjan() function.
This commit is contained in:
parent
6be6b9fb59
commit
f7fa8b74fd
@ -20,19 +20,66 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file
|
||||||
|
*
|
||||||
|
* Simple implementation of of Tarjan's algorithm for computing the
|
||||||
|
* strongly connected components of a directed graph, \f$G(V,E)\f$.
|
||||||
|
* Run-time complexity is \f$O(|V| + |E|)\f$.
|
||||||
|
*
|
||||||
|
* The implementation is based on
|
||||||
|
* "http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm".
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef TARJAN_H_INCLUDED
|
#ifndef TARJAN_H_INCLUDED
|
||||||
#define TARJAN_H_INCLUDED
|
#define TARJAN_H_INCLUDED
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
void
|
/**
|
||||||
tarjan (int nv, const int *ia, const int *ja, int *vert, int *comp,
|
* Compute the strongly connected components of a directed graph,
|
||||||
int *ncomp, int *work);
|
* \f$G(V,E)\f$.
|
||||||
|
*
|
||||||
|
* The components are returned in reverse topological sorted sequence.
|
||||||
|
*
|
||||||
|
* \param[in] nv Number of graph vertices.
|
||||||
|
*
|
||||||
|
* \param[in] ia
|
||||||
|
* \param[in] ja adjacency matrix for directed graph in compressed sparse row
|
||||||
|
* format: vertex i has directed edges to vertices ja[ia[i]],
|
||||||
|
* ..., ja[ia[i+1]-1].
|
||||||
|
*
|
||||||
|
* \param[out] vert Permutation of vertices into topologically sorted
|
||||||
|
* sequence of strong components (i.e., loops).
|
||||||
|
* Array of size <CODE>nv</CODE>.
|
||||||
|
*
|
||||||
|
* \param[out] comp Pointers to start of each strongly connected
|
||||||
|
* component in vert, the i'th component has vertices
|
||||||
|
* vert[comp[i]], ..., vert[comp[i+1] - 1]. Array of
|
||||||
|
* size <CODE>nv + 1</CODE>.
|
||||||
|
*
|
||||||
|
* \param[out] ncomp Number of strong components. Pointer to a single
|
||||||
|
* <CODE>int</CODE>.
|
||||||
|
*
|
||||||
|
* \param[out] work Pointer to a scratch array represented as a block
|
||||||
|
* of memory capable of holding <CODE>3 * nv</CODE>
|
||||||
|
* elements of type <CODE>int</CODE>.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
tarjan(int nv ,
|
||||||
|
const int *ia ,
|
||||||
|
const int *ja ,
|
||||||
|
int *vert ,
|
||||||
|
int *comp ,
|
||||||
|
int *ncomp,
|
||||||
|
int *work );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* TARJAN_H_INCLUDED */
|
#endif /* TARJAN_H_INCLUDED */
|
||||||
|
|
||||||
/* Local Variables: */
|
/* Local Variables: */
|
||||||
|
Loading…
Reference in New Issue
Block a user