Skip to content

Commit 1016ba6

Browse files
committed
D3128: fully specify triangle_count, directed_triangle_count, label propagation, and articulation points sections
- Triangle counting: new full spec for triangle_count (undirected) and directed_triangle_count, with mandates, preconditions, effects, returns, complexity, and remarks; corrected complexity from O(N^3) to O(m^(3/2)); fixed characteristic tables as non-floating to prevent drift; added directed_triangle_count.hpp prototype source file - Label propagation: unified two separate itemdescr blocks into one; added mandates, throws (std::bad_alloc), step-by-step effects, expanded remarks; fixed Throws? No→Yes; documented empty_label sentinel overload; removed requires clauses from lp.hpp prototype - Articulation points: expanded description with Hopcroft-Tarjan DFS explanation, disc/low-link definitions, root and non-root rules; added mandates, throws, expanded effects and remarks; fixed Throws? No→Yes - Fixed \tcode inside math mode errors throughout new sections
1 parent df3fe9f commit 1016ba6

4 files changed

Lines changed: 234 additions & 95 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Directed Triangle Counting Algorithm
3+
*/
4+
template <adjacency_list G>
5+
requires ordered_vertex_edges<G>
6+
[[nodiscard]] size_t directed_triangle_count(G&& g) noexcept;

D3128_Algorithms/src/lp.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ template <adjacency_list G,
55
class Label,
66
class Gen = default_random_engine,
77
class T = size_t>
8-
requires vertex_property_map_for<Label, G> &&
9-
equality_comparable<vertex_property_map_value_t<Label>> &&
10-
uniform_random_bit_generator<remove_cvref_t<Gen>>
118
void label_propagation(G&& g,
129
Label& label,
1310
Gen&& rng = default_random_engine{},
@@ -17,9 +14,6 @@ template <adjacency_list G,
1714
class Label,
1815
class Gen = default_random_engine,
1916
class T = size_t>
20-
requires vertex_property_map_for<Label, G> &&
21-
equality_comparable<vertex_property_map_value_t<Label>> &&
22-
uniform_random_bit_generator<remove_cvref_t<Gen>>
2317
void label_propagation(G&& g,
2418
Label& label,
2519
vertex_property_map_value_t<Label> empty_label,

D3128_Algorithms/src/shortest_paths_helpers.hpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@ concept edge_value_function = // For exposition only
44
std::invocable<WF, const G&, E> && !std::is_void_v<std::invoke_result_t<WF, const G&, E>>;
55

66
template <class G, class WF, class DistanceValue, class Compare, class Combine>
7-
concept basic_edge_weight_function = // For exposition only
8-
edge_value_function<WF, std::remove_reference_t<G>, edge_t<G>> &&
9-
is_arithmetic_v<DistanceValue> &&
10-
std::strict_weak_order<Compare, DistanceValue, DistanceValue> &&
11-
std::assignable_from<
12-
std::add_lvalue_reference_t<DistanceValue>,
13-
invoke_result_t<Combine,
14-
DistanceValue,
15-
invoke_result_t<WF, const std::remove_reference_t<G>&, edge_t<G>>>>;
7+
// For exposition only
8+
template <class G, class WF, class DistanceValue, class Compare, class Combine>
9+
concept basic_edge_weight_function = // e.g. weight(uv)
10+
edge_value_function<WF, std::remove_reference_t<G>, edge_t<G>> &&
11+
strict_weak_order<Compare, DistanceValue, DistanceValue> &&
12+
assignable_from<add_lvalue_reference_t<DistanceValue>,
13+
invoke_result_t<Combine, DistanceValue, invoke_result_t<WF, edge_t<G>>>>;
1614

15+
// For exposition only
1716
template <class G, class WF, class DistanceValue>
18-
concept edge_weight_function = // For exposition only
19-
is_arithmetic_v<invoke_result_t<WF, const std::remove_reference_t<G>&, edge_t<G>>> &&
17+
concept edge_weight_function = // e.g. weight(uv)
18+
is_arithmetic_v<edge_value_function<WF, std::remove_reference_t<G>, edge_t<G>>> &&
19+
is_arithmetic_v<DistanceValue> &&
20+
is_arithmetic_v<invoke_result_t<WF, edge_t<G>>> &&
2021
basic_edge_weight_function<G,
21-
WF,
22-
DistanceValue,
23-
less<DistanceValue>,
24-
plus<DistanceValue>>;
22+
WF,
23+
DistanceValue,
24+
less<DistanceValue>,
25+
plus<DistanceValue>>;
2526

2627
template <class DistanceValue>
2728
constexpr auto shortest_path_infinite_distance() {

0 commit comments

Comments
 (0)