Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ALGO] Tarjan's Strongly Connected Components #53

Closed
6 tasks
bobluppes opened this issue Aug 6, 2023 · 2 comments
Closed
6 tasks

[ALGO] Tarjan's Strongly Connected Components #53

bobluppes opened this issue Aug 6, 2023 · 2 comments
Assignees
Labels
enhancement New feature good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@bobluppes
Copy link
Owner

bobluppes commented Aug 6, 2023

Tarjan's Strongly Connected Components

Tarjan's algorithm can be used to find the Strongly Connected Components (SCCs) of a directed graph. An SCC is a subset of vertices in the graph for which every vertex is reachable from every other vertex in the subset. See the wikipedia entry for more details on Tarjan's algorithm.

Syntax

The algorithm should have the following syntax:

/**
 * Computes the Strongly Connected Components (SCCs) of a graph using Tarjan's algorithm.
 *
 * This function takes a graph and returns a vector of vectors representing the SCCs.
 * Each inner vector contains the vertices of a strongly connected component, and the outer vector
 * contains all the strongly connected components in the graph.
 *
 * @tparam V Vertex type.
 * @tparam E Edge type.
 * @param graph The graph for which to compute SCCs.
 * @return std::vector<std::vector<vertex_id_t>> A vector of vectors representing SCCs.
 */
template <typename V, typename E>
[[nodiscard]] std::vector<std::vector<vertex_id_t>> tarjans_strongly_connected_components(const graph<V, E, graph_type::DIRECTED>& graph);

This should live in the graaf::algorithm namespace under include/graaflib/algorithm/strongly_connected_components.h.

Definition of Done

This issue is done when:

  • The algorithm is implemented
  • The new function has a javadoc-style comment explaining the interface
  • Appropriate tests are added under test/graaflib/algorithm/strongly_connected_components_test.cpp
  • A test coverage of at least 95% is reached
  • A documentation entry is added under docs/docs/algorithms under the appropriate category
    • Just adding a short description and the algorithm syntax here is fine
    • See the wiki on how to build the documentation locally
  • The algorithm is added to the list of algorithms in README.md
@bobluppes bobluppes added enhancement New feature help wanted Extra attention is needed labels Aug 6, 2023
@bobluppes bobluppes added good first issue Good for newcomers and removed good first issue Good for newcomers labels Aug 6, 2023
@bobluppes bobluppes added this to the release 1.0.0 milestone Aug 9, 2023
@ndcroos
Copy link
Contributor

ndcroos commented Aug 12, 2023

Hi, I'd like to work on this after doing Bellman-Ford.

@bobluppes
Copy link
Owner Author

Hi @ndcroos, awesome, I will assign it to you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants