-
Notifications
You must be signed in to change notification settings - Fork 68
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
SCC condensation doesn't distinguish cyclic and acyclic single-node components #128
Comments
@michaelpj Indeed! I propose to modify the API with the following goals in mind:
One option would be to use the Perhaps, we should define our own This is still not ideal. I would prefer to have a non-empty set in the Thinking of (3), we could also switch to something like: scc :: Ord a => AdjacencyMap a -> AdjacencyMap (NonEmptyGraph a) Which I think ticks all the boxes, since we could then use Any other ideas? |
I think modelling SCCs as non empty graphs would be great, since it even preserves the inner graph structure of the component if you want it. More generally, if you had a graph model that includes subgraphs, you could model them as subgraphs. |
Agree, this looks like the best option. I will give it a try in the next couple of days. |
I've added a PR with a draft implementation: #130. |
I've finally finished #130. It took a long time, because it triggered a wave of refactoring (#131, #136). The resulting type signature is: import Algebra.Graph.AdjacencyMap
import qualified Algebra.Graph.NonEmpty.AdjacencyMap as NonEmpty
scc :: Ord a => AdjacencyMap a -> AdjacencyMap (NonEmpty.AdjacencyMap a) @michaelpj Does this look good? You can now distinguish acyclic components simply by using Feel free to reopen if I missed anything. |
The interface looks great! I'll try and give it a spin later. |
@michaelpj Thanks! I'd appreciate some feedback on the performance in your use case. I am a bit worried about using heavy-weight vertex types like |
I'm not using it in a performance-sensitive context, but I'll keep you posted. |
This can be very important.
Data.Graph
does it, it would be great ifalga
did too.The text was updated successfully, but these errors were encountered: