pnevyk / gryf

Graph data structure library aspiring to be convenient, versatile, correct and performant.
MIT License
69 stars 1 forks source link

Check number of edges when testing if graph is a path #9

Open pnevyk opened 2 years ago

pnevyk commented 2 years ago

When checking if a graph is a valid path here, the code should check if it's even possible to be true given the number of vertices and edges, as a path must have n - 1 edges. This can early identify some non-paths.

Implement the number of edges in a path as another fact (zero vertices must be correctly handled, too).