Skip to content

return.vs.es: fix performance, then deprecate and remove #2695

@schochastics

Description

@schochastics

This issue unifies three related threads:

They are the same problem from three angles: the option exists mainly for
performance (#557), it is applied inconsistently (#1614), and the
long-term goal is to remove it (#1652) with as.integer() as the
replacement. Removal is blocked until the performance gap is closed — e.g.
max_cliques(sample_gnp(500, 0.15)) is ~8× slower with return.vs.es = TRUE
(268 ms vs 33 ms) because create_vs() builds names eagerly. The endorsed
direction is lazy (ALTREP) naming so igraph.vs/igraph.es is as cheap as a
numeric vector and names are materialized only on print/use.

Steps to close

Phase 0 — Close the performance gap (prerequisite)

  • Make vertex/edge sequence construction lazy (ALTREP-backed names), so
    create_vs()/create_es() and E() defer the names/vnames work
    until printed or accessed.
  • Benchmark gate: max_cliques(sample_gnp(500, 0.15)) with the default
    approaches the old return.vs.es = FALSE timing. If the gap isn't
    closed, stop here
    — do not proceed to removal.

Phase 1 — Decouple internal usage from the public option

  • Give the _impl layer a private numeric-output path that does not read
    return.vs.es.
  • Replace the with_igraph_opt(list(return.vs.es = FALSE), ...) wrappers in
    all_simple_paths() and get_edge_ids() with that mechanism (no
    user-visible change).

Phase 2 — Soft-deprecate the option

  • Emit lifecycle::deprecate_warn() when a user sets return.vs.es,
    pointing to as.integer() / as_ids().
  • Update the option's roxygen doc entry with a deprecation badge + recipe.
  • Add a NEWS entry. Keep the option functional for at least one release.

Phase 3 — Remove

  • Drop the if (igraph_opt("return.vs.es")) guard from the OUTCONV
    templates in tools/stimulus/types-RR.yaml (keep the create_vs/
    create_es body; keep the vcount() != 0 guard for VERTEX_ROOT).
  • Regenerate the R/aaa-*.R files (103 sites) via codegen — do not hand-edit.
  • Remove the 24 hand-written guards (keep their wrapping bodies).
  • Remove return.vs.es from .igraph.pars and its doc entry in R/par.R;
    make the deprecated setter hard-error or no-op.
  • Update roxygen prose referencing the option (regenerate .Rd in CI).
  • Update/trim tests; full R CMD check; run tools/revdep.R before release.

Metadata

Metadata

Assignees

No one assigned

    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