-
Notifications
You must be signed in to change notification settings - Fork 12
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
Project-to-DAG runtime #205
Comments
Toy example to greedily build a topological order by maximizing the sum of outgoing edge weight magnitudes at each level. Projects 1e4 random fully-connected graphs with 50 nodes each in about 1 min.
|
While this maximizes the sum of child edges as each level, this algorithm would also place a root node with outdegree 1 last in the topological order when it would be optimal to put this node first. Instead we could greedily select root-like nodes that have the smallest sum of incoming edges, since we know there would be another node that would add more to the total edge weight sum as a child of other nodes.
|
I came across this by accident, and I'm likely misunderstanding what you are saying ...
But I wanted to point out that the linear-time algorithm igraph uses to test if a graph is a DAG does not involve the construction of any spanning trees |
Thanks for clarifying @szhorvat! |
Thanks @szhorvat; btw how did you find this project? |
Can you clarify if there is an issue with the performance of igraph's DAG testing? The current implementation is based on removing source (i.e. zero in-degree) vertices until none are left. If the entire graph was removed, then it was a DAG. An alternative is performing graph traversal (DFS or BFS) to look for cycles. This is not implemented at the moment. Both are linear-time in the worst case, i.e. when the graph is acyclic, they will both explore all edges. It's unclear which one would be faster in practice. It might depend on the structure of the graph (does it have cycles?). More likely, the performance difference depends on hardware-related non-algorithmic factors, so this needs benchmarking. At some point I might implement a DFS-based function that doesn't just check if the graph is acyclic, but provides proof, i.e. returns a cycle if there is one. We always welcome feedback about how people use igraph and what their needs are. Feel free to contact us on the forum https://igraph.discourse.group/ |
Based on what you've said, it sounds like the issue is not igraph's runtime but I'll continue to update the issue this week. |
Currently we do DAG projection by binary search O(logn) over sorted weights O(nlogn), checking if the graph where weights > threshold is a DAG via igraph is_dag O(n*n). The igraph implementation gets a spanning tree to check for dagness. This is prohibitively slow for large DAGs.
Can we speed this up? Maybe by using spanning trees to construct a new graph.
The text was updated successfully, but these errors were encountered: