-
Notifications
You must be signed in to change notification settings - Fork 42
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
ExecuteDFS (generic depth first search) #459
Conversation
…into new-dfs Continueing to convert methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments on doc concerning theory etc :) @james-d-mitchell you have looked at this project closely so maybe reachability and connectivity etc were misinterpreted by me, but any views on this specific point about connected components etc would be most valuable :)
doc/oper.xml
Outdated
<A>record</A>.child) is an edge and <A>record</A>.child has been visited before <A>record</A>.current | ||
and it is not an ancestor of <A>record</A>.current</Item> | ||
</List> | ||
Note that this function only performs a depth first search on the connected graph that has <A>start</A>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this function only performs a depth first search on the connected graph that has <A>start</A>. | |
Note that this function only performs a depth first search on the connected component that contains <A>start</A>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think however that this line should be completely changed to "the digraph induced by the vertices reachable from start.
In undirected graphs this would indeed be the connected component containing start. However in directed graphs we might have a connected graph and vertices that are not reachable from the start vertex :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is much clearer!
doc/oper.xml
Outdated
causing us to backtrack. This vertex is stored in <A>record</A>.child and its parent is stored | ||
in <A>record</A>.current</Item> | ||
<Item><A>AncestorFunc</A>: this function is called when (<A>record</A>.current, | ||
<A>record</A>.child) is an edge and <A>record</A>.child is an ancestor of <A>record</A>.current. An ancestor here means that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<A>record</A>.child) is an edge and <A>record</A>.child is an ancestor of <A>record</A>.current. An ancestor here means that | |
<A>record</A>.child) is an edge and <C><A>record</A>.child</C> is an ancestor of <A>record</A>.current. An ancestor here means that |
doc/oper.xml
Outdated
|
||
The record also stores a further 4 attributes. | ||
<List> | ||
<Item><E>current</E>: the current vertex that is being visited</Item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use mark here too?
doc/oper.xml
Outdated
</List> | ||
|
||
Initially, the current and child attributes will have -1 values and the lists (parent, | ||
preorder and postorder) will have -1 values at all of their indicies as no vertex has |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preorder and postorder) will have -1 values at all of their indicies as no vertex has | |
<C>preorder</C> and <C>postorder</C>) will have <C>-1</C> values at all of their indices as no vertex has |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor suggestions for the doc, I think this is great otherwise, and is a real improvement!
…into new-dfs-adapted
Extreme tests: UndirectedSpanningForest
DigraphPath
DigraphTopologicalSort
DigraphLongestDistanceFromVertex
IsAntisymmetricDigraph
IsAcyclicDigraph
DIGRAPHS_ArticulationPointsBridgesStrongOrientation
VerticesReachableFrom
DominatorTree
|
In particular, this pretty much reverses commit: d9f060c
In particular, this pretty much reverses commit: d9f060c
In particular, this pretty much reverses commit: d9f060c
In this pull request, I submit my work for VP2215.
I did this to resolve the issue noted in #393
From this pull request you will see that I have created:
preorder function, postorder function, ancestor function and a cross function.
current and child attributes
The generic depth first search algorithm works as follows:
I also refactored the existing DFS implementations in: