-
Notifications
You must be signed in to change notification settings - Fork 0
/
clique_3.hh
57 lines (47 loc) · 1.06 KB
/
clique_3.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef CLIQUE_3_HH
#define CLIQUE_3_HH
#include <cstddef>
#include "factorial.hh"
namespace cct
{
template< typename Graph >
class Clique_3
{
private:
const Graph graph;
public:
consteval Clique_3( Graph g ) : graph{ g }
{}
auto
consteval operator()( void ) const
{
std::size_t quantity_cliques{ 0u };
for( std::size_t a{ 0u }; a < size( graph ); ++a )
{
for( std::size_t b{ 0u }; b < size( graph ); ++b )
{
if( b == a ||
0 == graph[ a ][ b ] )
{
continue;
}
for( std::size_t c{ 0u }; c < size( graph ); ++c )
{
if( c == a ||
c == b )
{
continue;
}
if( 1 == graph[ b ][ c ] &&
1 == graph[ c ][ a ] )
{
++quantity_cliques;
}
}
}
}
return quantity_cliques / factorial< int, 3 >();
}
};
}
#endif