44 operator int()
const {
return value; }
55template<
typename Key,
typename Weight>
74 double w_density = 0.3;
101 static constexpr const char* SIMILARITY_TABLE_FILE_NAME =
"output_parsed.txt";
102 static constexpr const double DEFAULT_SIMILARITY = 100.00;
103 static constexpr const double EPS_ERROR_MARGIN = 1e-6;
104 static constexpr const double MAXIMUM_SIMILARITY = 100.00;
105 static constexpr const double MINIMUM_SIMILARITY = 0.00;
107 double similarity_threshold;
108 std::vector<Path> paths;
109 std::map<Path, PathId> path_id;
115 std::map<std::pair<PathId, PathId>,
double> similarity_table;
131 void read_comparation(std::ifstream& table_file);
137 void read_file_table(std::ifstream& table_file);
142 void init_similarity_table();
149 bool is_above_threshold(
double similarity)
const;
156 std::vector<std::tuple<int, Path, Path>> sort_pairs_by_line_number(
const std::vector<std::pair<Path, Path>>& similar_path_pairs)
const;
Path manipulation class for tool-specific directory structure.
Represents a similarity graph between functions (paths).
void update_similarity(double new_similarity_threshold)
Updates similarity threshold.
std::vector< std::tuple< double, Path, Path > > get_all_path_pairs_and_similarity_sorted_by_similarity()
Gets all similar path pairs with scores, sorted.
std::vector< ClusterInfo > get_clusters_info(bool sorted)
Returns detailed information about all clusters found in the similarity table.
int get_number_lines_in_pair(const Path &path1, const Path &path2)
Similarity_Table()
Constructs with default similarity threshold.
std::vector< std::pair< Path, Path > > get_all_similar_path_pairs_sorted_by_similarity()
Gets all similar path pairs, sorted by similarity.
double get_similarity(const Path &path1, const Path &path2)
Gets similarity between two paths.
std::vector< Cluster > get_clusters()
Generate clusters of similar functions using DFS on the similarity graph.
std::vector< std::pair< Path, Path > > get_all_similar_path_pairs_sorted_by_line_number()
Gets all similar path pairs, sorted by line count.
const std::vector< Path > & get_path_list() const
Gets list of all known paths.
bool is_similar(const Path &path1, const Path &path2)
Checks if two paths are similar.
std::vector< Path > get_similar_path_to_the_reference(const Path &reference)
Gets paths similar to reference path.
Configuration management interface.
Function abstraction for temporary codebase.
Path abstraction for temporary codebase.
std::vector< std::vector< std::pair< Key, Weight > > > AdjacencyList
{ 1: [{ key, weight }, { key, weight }] 2: [{ key, weight }] 3: [] ... }
std::vector< Path > paths
Represents a cluster of similar functions in the similarity graph.
std::vector< int > members
List of node indices (Path IDs) in the cluster.
bool operator==(const PathId &other) const
bool operator!=(const PathId &other) const
bool operator<(const PathId &other) const
Defines utility functions used across all files.