boostorg / boostorg/graph

`compressed_sparse_row_graph` has orphaned `add_vertex()` / `add_vertices()` from removed interface

Open
#474 9 comments 0 reactions 0 assignees View on GitHub
priority: low technical debt
Dominant language
C++
Stars
392
Forks
239
Avg merge
1d 11m
Merged PRs (30d)
20

Description

## Problem

`compressed_sparse_row_graph.hpp` contains four public `add_vertex` / `add_vertices` functions that were part of an old interface deliberately removed in 2009:

- [Old interface documentation](https://www.boost.org/doc/libs/1_40_0/libs/graph/doc/compressed_sparse_row.html)
- [New interface documentation](https://www.boost.org/doc/libs/1_41_0/libs/graph/doc/compressed_sparse_row.html)

```cpp
Vertex add_vertex(compressed_sparse_row_graph& g);
Vertex add_vertex(compressed_sparse_row_graph& g, const vertex_bundled& p); // directed
Vertex add_vertex(compressed_sparse_row_graph& g, const vertex_bundled& p); // bidirectional
Vertex add_vertices(vertices_size_type count, compressed_sparse_row_graph& g); // directed
```

These are not in the HTML documentation, not tested in `test/csr_graph_test.cpp`, and not used anywhere in BGL internally.

Meanwhile, the documentation states: "The CSR graph is immutable after construction. You cannot call `add_vertex()`."

The related `add_edges()` and `add_edges_sorted()` functions are documented and tested.

## History

- 2005 (`0e2f4646`): Jeremiah Willcock added `add_vertex()`, `add_vertices()`, and `add_edges()` as "incremental construction functions." All three were documented and tested.
- 2009 (`b2636ec3`, "Removed old CSR interface; fixes #3135 "): `add_vertex()` and `add_vertices()` were removed from documentation and tests, but the implementations were left in the header.
- 2012 (`849d1538`): `add_edges()` was separately removed from bidirectional CSR as "broken and not documented."

## Question

Should `add_vertex()` / `add_vertices()` be tested and documented, or removed? Probably removed I guess, but I find it odd the implementation was never actually removed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.