Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
Discrete Optimization Library
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bachelorarbeit
Discrete Optimization Library
Commits
bfd6600e
Commit
bfd6600e
authored
Oct 10, 2020
by
Jonas Seidel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dfs correction
parent
4230e6f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
Graphtheory/Graph_advanced.ipp
Graphtheory/Graph_advanced.ipp
+12
-11
No files found.
Graphtheory/Graph_advanced.ipp
View file @
bfd6600e
...
...
@@ -51,30 +51,31 @@ void Graph::conditional_bfs_all_components(
node_exec need to return true in order to continue traversal over its incident edges
*/
std::set<Node*> uncharted = this->nodes();
std::deque<Node*> active = starting_nodes;
std::deque<std::pair<Edge*, Node*>> active;
for(Node* node : starting_nodes){
active.push_back({nullptr, node});
}
while(!uncharted.empty()){
if(active.empty()){
active.push_back(
*uncharted.begin()
);
active.push_back(
{nullptr, *uncharted.begin()}
);
uncharted.erase(*uncharted.begin());
}
for(Node* manually_inserted_node : active){
node_exec(nullptr, manually_inserted_node);
}
while(!active.empty()){
Node* n = active.front(); active.pop_front();
std::pair<Edge*, Node*> next = active.front(); active.pop_front();
bool local_all_paths = node_exec(next.first, next.second);
Node* n = next.second;
uncharted.erase(n);
for(Edge* e : n->incident()){
bool used_in_traversal = false;
if(guide(n, e)){
if(uncharted.find(e->to(n)) != uncharted.end() || all_paths
)
{
if(uncharted.find(e->to(n)) != uncharted.end() || all_paths
|| local_all_paths)
{
used_in_traversal = true;
if(node_exec(e, e->to(n))){
active.push_back(e->to(n));
}
uncharted.erase(e->to(n));
active.push_back({e, e->to(n)});
}
edge_exec(n, e, used_in_traversal);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment