Skip to content

Should an exception be thrown if a graph contains a cycle #12

@EwanC

Description

@EwanC

The free function make_edge() allows users to create a cycle in a graph, which goes against the DAG definition of a graph.

If we do want to error on cycles, checking for them in make_edge would turn it into a costly operation, especially for graphs at large scale. Because you would have to run the analysis each time you connect two nodes. Instead, having this error when the executable graph is created would avoid repeatedly paying the cost of analysing the graph.

It may also be the kind of check that would be useful for users while developing an application, but once they actually want to release the application would be unwanted overhead. So we could specify a mechanism for making this check optional. CUDA has cudaGraphInstantiateWithFlags, we could potentially add a flags parameter to finalize() that would allow a user to pass in configuration information for creating the executable graph? E.g a validate flag that would do this cycle check and possibly other verifications. Other optimization flags could be added here in the future if deemed necessary.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions