Draft
feat: make graph constructors default to undirected for consistency#2453
Conversation
Change make_tree(), make_star(), and make_graph() to default to undirected graphs for consistency with other graph constructors. Update tests accordingly. Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Fix issue where directed parameter wasn't being passed to old_graph when using default value, causing graphs to incorrectly default to directed. Update additional tests that relied on old defaults. Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Fix remaining test failures by adding explicit directed=TRUE where tests expect directed graphs. Update snapshots for visual tests. Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix inconsistent graph constructors default behavior
feat: make graph constructors default to undirected for consistency
Oct 28, 2025
10 tasks
Carry this branch's undirected-by-default constructor change onto main's migrated make functions: - R/make.R: main's ellipsis signatures and ARG_HANDLE blocks with this branch's default order (make_star mode "undirected" first, make_tree likewise, make_graph()/graph() directed = FALSE); tools/migrations/make.R updated and blocks regenerated. - Conflicted tests: main's igraph_local_seed()/lifecycle pins with this branch's explicit mode=/directed= call sites; main's impl-snapshot tests keep main's implicit calls (their snapshots now reflect the undirected default). Adapted main's alpha_centrality() coverage DAG to directed = TRUE. - man pages re-rendered with roxygen2. Branch-touched test files (make, aaa-auto, centrality, paths, print-classic, structural-properties) pass FAIL 0 WARN 0. The full suite still has failures in files this draft has not yet updated for the new defaults (e.g. flow, conversion edge order) -- those predate this merge and are the draft's remaining work. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
…structors-defaults
Contributor
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 2d0cce7 is merged into main:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Graph constructors were inconsistent - some defaulted to directed (
make_tree,make_star,make_graph) while most defaulted to undirected (sample_gnm,make_ring,make_full_graph). This creates unnecessary confusion.Changes
make_tree(): Now defaults tomode = "undirected"(was"out")make_star(): Now defaults tomode = "undirected"(was"in")make_graph(): Now defaults todirected = FALSE(wasTRUE)make_graph()ignored its defaultdirectedparameter when using numeric edge vectorsgraph(),graph.tree(),graph.star()) to matchBefore/After
Breaking Change
This is a breaking change for v2.0. Code relying on implicit directed defaults must be updated to explicitly specify
directed = TRUEormode = "in"/"out".Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.