Skip to content

is_connected() is too slow #398

@Wavetrace

Description

@Wavetrace

is_connected function is documented as

// Is the undirected graph connected?
// Is the directed graph strongly connected?

and achieves this goal by checking if each vertex is reachable from each other one. This is unnecessarily resource-consuming and slow, O(n^3) (or even O(n^4)). You could call this a performance bug.

Please see PR397 (#397) that fixes this to run in O(N) (O(N+E)).

See the attached log_vec.txt for speed evaluation.
log-vec.txt
(please tell if you're interested in the program that generates it)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions