Skip to content
Snippets Groups Projects
Commit 89caa89e authored by David Rosca's avatar David Rosca
Browse files

Topological sort: Remove function for Undirected Graph

+ fix unused variables warning
parent 21795733
No related branches found
No related tags found
No related merge requests found
......@@ -9,8 +9,7 @@ namespace graph
namespace sort
{
 
template <typename T>
static TopologicalSort::Result topsort_impl(const T &graph)
static TopologicalSort::Result topsort_impl(const DirectedGraph &graph)
{
TopologicalSort::Result s;
std::unordered_map<Node, bool> visited;
......@@ -41,11 +40,6 @@ TopologicalSort::Result TopologicalSort::topologicalsort(const DirectedGraph &gr
return topsort_impl(graph);
}
 
TopologicalSort::Result TopologicalSort::topologicalsort(const UndirectedGraph &graph)
{
return topsort_impl(graph);
}
void TopologicalSort::Visit(void *data, const DirectedGraph &graph) const
{
Result *r = static_cast<Result*>(data);
......@@ -54,6 +48,8 @@ void TopologicalSort::Visit(void *data, const DirectedGraph &graph) const
 
void TopologicalSort::Visit(void *data, const UndirectedGraph &graph) const
{
(void) data;
(void) graph;
throw exception::AlibException("Unsupported graph type UndirectedGraph");
}
 
......
#ifndef GRAPH_TOPOLOGICAL_SORT_FORD_H_
#define GRAPH_TOPOLOGICAL_SORT_FORD_H_
#ifndef GRAPH_TOPOLOGICAL_SORT_H_
#define GRAPH_TOPOLOGICAL_SORT_H_
 
#include <list>
 
......@@ -21,7 +21,6 @@ public:
static Result topologicalsort(const Graph &graph);
 
static Result topologicalsort(const DirectedGraph &graph);
static Result topologicalsort(const UndirectedGraph &graph);
 
private:
void Visit(void *data, const DirectedGraph &graph) const;
......@@ -34,4 +33,4 @@ private:
 
} // namespace graph
 
#endif // GRAPH_TOPOLOGICAL_SORT_FORD_H_
#endif // GRAPH_TOPOLOGICAL_SORT_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment