Skip to content

Commit

Permalink
Clang-format version 16
Browse files Browse the repository at this point in the history
  • Loading branch information
R. Kaleta committed Sep 21, 2023
1 parent 1b90e0c commit 6ff3ee2
Show file tree
Hide file tree
Showing 25 changed files with 425 additions and 258 deletions.
29 changes: 20 additions & 9 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# VERSION 14
# VERSION 16

AccessModifierOffset: -4
AlignAfterOpenBracket: Align
Expand All @@ -9,9 +9,12 @@ AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
AlignEscapedNewlines: DontAlign
AlignOperands: Align
AlignTrailingComments: false
AlignTrailingComments:
Kind: Never
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
#18 AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
Expand All @@ -25,10 +28,10 @@ AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: false
BitFieldColonSpacing: Both
BreakAfterAttributes: Always
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakBeforeConceptDeclarations: true
#15 BreakBeforeConceptDeclarations: Always
BreakBeforeConceptDeclarations: Always
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
Expand Down Expand Up @@ -74,12 +77,18 @@ IndentCaseLabels: true
IndentExternBlock: NoIndent
IndentGotoLabels: false
IndentPPDirectives: None
IndentRequires: true
#15 IndentRequiresClause: true
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
#15 InsertBraces: false
InsertBraces: false
InsertNewlineAtEOF: true
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 4
Decimal: 3
DecimalMinDigits: 7
Hex: -1
#17 KeepEmptyLinesAtEOF: false
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
MaxEmptyLinesToKeep: 1
Expand All @@ -90,11 +99,12 @@ PointerAlignment: Middle
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: false
#15 RequiresClausePosition: OwnLine
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortUsingDeclarations: true
SortUsingDeclarations: Lexicographic
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
Expand All @@ -117,6 +127,7 @@ SpacesInContainerLiterals: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: 1
#17 SpacesInParens: Never
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++17
Expand Down
25 changes: 14 additions & 11 deletions include/algolib/graphs/algorithms/lowest_common_ancestor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ namespace algolib::graphs
{
#pragma region lowest_common_ancestor

template <typename VertexId = size_t, typename VertexProperty = std::nullptr_t,
template <typename VertexId = size_t,
typename VertexProperty = std::nullptr_t,
typename EdgeProperty = std::nullptr_t>
class lowest_common_ancestor
{
Expand Down Expand Up @@ -69,10 +70,10 @@ namespace algolib::graphs
template <typename VertexId, typename VertexProperty, typename EdgeProperty>
typename lowest_common_ancestor<VertexId, VertexProperty, EdgeProperty>::vertex_type
lowest_common_ancestor<VertexId, VertexProperty, EdgeProperty>::find(
const lowest_common_ancestor<VertexId, VertexProperty,
EdgeProperty>::vertex_type & vertex1,
const lowest_common_ancestor<VertexId, VertexProperty,
EdgeProperty>::vertex_type & vertex2)
const lowest_common_ancestor<VertexId, VertexProperty, EdgeProperty>::
vertex_type & vertex1,
const lowest_common_ancestor<VertexId, VertexProperty, EdgeProperty>::
vertex_type & vertex2)
{
if(this->is_offspring(vertex1, vertex2))
return vertex2;
Expand Down Expand Up @@ -107,10 +108,10 @@ namespace algolib::graphs

template <typename VertexId, typename VertexProperty, typename EdgeProperty>
bool lowest_common_ancestor<VertexId, VertexProperty, EdgeProperty>::is_offspring(
const typename lowest_common_ancestor<VertexId, VertexProperty,
EdgeProperty>::vertex_type & vertex1,
const typename lowest_common_ancestor<VertexId, VertexProperty,
EdgeProperty>::vertex_type & vertex2)
const typename lowest_common_ancestor<VertexId, VertexProperty, EdgeProperty>::
vertex_type & vertex1,
const typename lowest_common_ancestor<VertexId, VertexProperty, EdgeProperty>::
vertex_type & vertex2)
{
return this->strategy.pre_times[vertex1] >= this->strategy.pre_times[vertex2]
&& this->strategy.post_times[vertex1] <= this->strategy.post_times[vertex2];
Expand All @@ -121,10 +122,12 @@ namespace algolib::graphs

template <typename VertexId, typename VertexProperty, typename EdgeProperty>
struct lowest_common_ancestor<VertexId, VertexProperty, EdgeProperty>::lca_strategy
: public dfs_strategy<typename lowest_common_ancestor<VertexId, VertexProperty,
: public dfs_strategy<typename lowest_common_ancestor<VertexId,
VertexProperty,
EdgeProperty>::vertex_type>
{
using vertex_type = typename lowest_common_ancestor<VertexId, VertexProperty,
using vertex_type = typename lowest_common_ancestor<VertexId,
VertexProperty,
EdgeProperty>::vertex_type;

lca_strategy() : timer{0}
Expand Down
22 changes: 12 additions & 10 deletions include/algolib/graphs/algorithms/matching.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ namespace internal
private:
std::vector<typename graph_t::vertex_type> unmatched_vertices();
void bfs(std::unordered_map<typename graph_t::vertex_type, double> & distances);
bool dfs(const typename match_augmenter<VertexId, VertexProperty,
EdgeProperty>::graph_t::vertex_type & vertex,
bool dfs(const typename match_augmenter<VertexId, VertexProperty, EdgeProperty>::graph_t::
vertex_type & vertex,
std::unordered_set<typename graph_t::vertex_type> & visited,
const std::unordered_map<typename graph_t::vertex_type, double> & distances);

Expand Down Expand Up @@ -83,8 +83,8 @@ namespace internal

template <typename VertexId, typename VertexProperty, typename EdgeProperty>
void match_augmenter<VertexId, VertexProperty, EdgeProperty>::bfs(
std::unordered_map<typename match_augmenter<VertexId, VertexProperty,
EdgeProperty>::graph_t::vertex_type,
std::unordered_map<typename match_augmenter<VertexId, VertexProperty, EdgeProperty>::
graph_t::vertex_type,
double> & distances)
{
std::queue<typename graph_t::vertex_type> vertex_queue;
Expand Down Expand Up @@ -116,11 +116,12 @@ namespace internal

template <typename VertexId, typename VertexProperty, typename EdgeProperty>
bool match_augmenter<VertexId, VertexProperty, EdgeProperty>::dfs(
const typename match_augmenter<VertexId, VertexProperty,
EdgeProperty>::graph_t::vertex_type & vertex,
std::unordered_set<typename match_augmenter<
VertexId, VertexProperty, EdgeProperty>::graph_t::vertex_type> & visited,
const std::unordered_map<typename match_augmenter<VertexId, VertexProperty,
const typename match_augmenter<VertexId, VertexProperty, EdgeProperty>::graph_t::
vertex_type & vertex,
std::unordered_set<typename match_augmenter<VertexId, VertexProperty, EdgeProperty>::
graph_t::vertex_type> & visited,
const std::unordered_map<typename match_augmenter<VertexId,
VertexProperty,
EdgeProperty>::graph_t::vertex_type,
double> & distances)
{
Expand Down Expand Up @@ -160,7 +161,8 @@ namespace algolib::graphs
* \param graph a bipartite graph
* \return map of matched vertices
*/
template <typename VertexId = size_t, typename VertexProperty = std::nullptr_t,
template <typename VertexId = size_t,
typename VertexProperty = std::nullptr_t,
typename EdgeProperty = std::nullptr_t>
std::unordered_map<
typename multipartite_graph<2, VertexId, VertexProperty, EdgeProperty>::vertex_type,
Expand Down
10 changes: 6 additions & 4 deletions include/algolib/graphs/algorithms/searching.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ namespace internal
template <typename VertexId, typename VertexProperty, typename EdgeProperty>
void dfs_recursive_step(
const algr::graph<VertexId, VertexProperty, EdgeProperty> & graph_,
algr::dfs_strategy<typename algr::graph<VertexId, VertexProperty,
EdgeProperty>::vertex_type> & strategy,
dfs_recursive_state<typename algr::graph<VertexId, VertexProperty,
EdgeProperty>::vertex_type> & state)
algr::dfs_strategy<
typename algr::graph<VertexId, VertexProperty, EdgeProperty>::vertex_type> &
strategy,
dfs_recursive_state<
typename algr::graph<VertexId, VertexProperty, EdgeProperty>::vertex_type> &
state)
{
typename algr::graph<VertexId, VertexProperty, EdgeProperty>::vertex_type vertex =
state.vertex.value();
Expand Down
15 changes: 8 additions & 7 deletions include/algolib/graphs/algorithms/shortest_paths.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ namespace algolib::graphs
*/
template <typename VertexId, typename VertexProperty, typename EdgeProperty>
std::unordered_map<typename directed_graph<VertexId, VertexProperty, EdgeProperty>::vertex_type,
typename directed_graph<VertexId, VertexProperty,
EdgeProperty>::edge_property_type::weight_type>
bellman_ford(const directed_graph<VertexId, VertexProperty, EdgeProperty> & graph,
typename directed_graph<VertexId, VertexProperty,
EdgeProperty>::vertex_type source)
typename directed_graph<VertexId, VertexProperty, EdgeProperty>::
edge_property_type::weight_type>
bellman_ford(
const directed_graph<VertexId, VertexProperty, EdgeProperty> & graph,
typename directed_graph<VertexId, VertexProperty, EdgeProperty>::vertex_type
source)
{
std::unordered_map<
typename directed_graph<VertexId, VertexProperty, EdgeProperty>::vertex_type,
Expand Down Expand Up @@ -83,8 +84,8 @@ namespace algolib::graphs
*/
template <typename VertexId, typename VertexProperty, typename EdgeProperty>
std::unordered_map<typename directed_graph<VertexId, VertexProperty, EdgeProperty>::vertex_type,
typename directed_graph<VertexId, VertexProperty,
EdgeProperty>::edge_property_type::weight_type>
typename directed_graph<VertexId, VertexProperty, EdgeProperty>::
edge_property_type::weight_type>
dijkstra(const graph<VertexId, VertexProperty, EdgeProperty> & graph_,
typename graph<VertexId, VertexProperty, EdgeProperty>::vertex_type source)
{
Expand Down
27 changes: 14 additions & 13 deletions include/algolib/graphs/directed_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ namespace algolib::graphs
virtual void reverse() = 0;
};

template <typename VertexId = size_t, typename VertexProperty = std::nullptr_t,
template <typename VertexId = size_t,
typename VertexProperty = std::nullptr_t,
typename EdgeProperty = std::nullptr_t>
class directed_simple_graph
: public simple_graph<VertexId, VertexProperty, EdgeProperty>,
Expand Down Expand Up @@ -97,8 +98,8 @@ namespace algolib::graphs

template <typename VertexId, typename VertexProperty, typename EdgeProperty>
size_t directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::input_degree(
const typename directed_simple_graph<VertexId, VertexProperty,
EdgeProperty>::vertex_type & vertex) const
const typename directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::
vertex_type & vertex) const
{
size_t degree = 0;

Expand All @@ -112,8 +113,8 @@ namespace algolib::graphs
template <typename VertexId, typename VertexProperty, typename EdgeProperty>
typename directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::edge_type
directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::add_edge(
const typename directed_simple_graph<VertexId, VertexProperty,
EdgeProperty>::edge_type & edge)
const typename directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::
edge_type & edge)
try
{
this->operator[](std::make_pair(edge.source(), edge.destination()));
Expand All @@ -128,10 +129,10 @@ namespace algolib::graphs
template <typename VertexId, typename VertexProperty, typename EdgeProperty>
typename directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::edge_type
directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::add_edge(
const typename directed_simple_graph<VertexId, VertexProperty,
EdgeProperty>::edge_type & edge,
const typename directed_simple_graph<
VertexId, VertexProperty, EdgeProperty>::edge_property_type & property)
const typename directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::
edge_type & edge,
const typename directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::
edge_property_type & property)
try
{
this->operator[](std::make_pair(edge.source(), edge.destination()));
Expand Down Expand Up @@ -172,10 +173,10 @@ namespace algolib::graphs
template <typename VertexId, typename VertexProperty, typename EdgeProperty>
directed_simple_graph<
typename directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::vertex_id_type,
typename directed_simple_graph<VertexId, VertexProperty,
EdgeProperty>::vertex_property_type,
typename directed_simple_graph<VertexId, VertexProperty,
EdgeProperty>::edge_property_type>
typename directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::
vertex_property_type,
typename directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::
edge_property_type>
directed_simple_graph<VertexId, VertexProperty, EdgeProperty>::reversed_copy() const
{
directed_simple_graph<vertex_id_type, vertex_property_type, edge_property_type>
Expand Down
Loading

0 comments on commit 6ff3ee2

Please sign in to comment.