<commit_before>/*
 * GreedyCommunityExpansion.h
 *
 *  Created on: 03.06.2013
 *      Author: cls
 */

#ifndef GREEDYCOMMUNITYEXPANSION_H_
#define GREEDYCOMMUNITYEXPANSION_H_

#include <unordered_set>

#include "SelectiveCommunityDetector.h"


namespace NetworKit {

class GreedyCommunityExpansion: public NetworKit::SelectiveCommunityDetector {

public:

	class QualityObjective {
	public:
		Graph G;
		std::unordered_set<node>* community;

		/**
		 * @param[in]	G	the graph
		 * @param[in]	community	the currently expanding community
		 */
	public:
		QualityObjective(Graph& G, std::unordered_set<node>* community);
		virtual ~QualityObjective();
		virtual double getValue(node v) = 0;
	};

	/**
	 * LocalModularityM as a quality objective function
	 */
	class LocalModularityM : public QualityObjective {
	public:
		LocalModularityM(Graph& G, std::unordered_set<node>* community);
		virtual ~LocalModularityM();
		virtual double getValue(node v);
	};

	class Conductance : public QualityObjective {
		public:
		Conductance(Graph& G, std::unordered_set<node>* community);
			virtual ~Conductance();
			virtual double getValue(node v);
		};

	/**
	 * Acceptability measures quantify how likely a new node from the shell
	 * is to improve the community when it is included.
	 */
	class Acceptability {
	public:
		Graph G;
		std::unordered_set<node>* community;
		std::unordered_set<node>* shell;
	public:
		Acceptability(Graph& G, std::unordered_set<node>* community, std::unordered_set<node>* shell);
		virtual ~Acceptability();
		virtual double getValue(node v) = 0;
	};


	class NodeClusterSimilarity: public Acceptability {
	public:
		NodeClusterSimilarity(Graph& G, std::unordered_set<node>* community, std::unordered_set<node>* shell);
		virtual ~NodeClusterSimilarity();
		virtual double getValue(node v);
	};


	GreedyCommunityExpansion();

	virtual ~GreedyCommunityExpansion();

	/**
	 * @param[in]	G	input graph
	 * @param[in]	s	seed node
	 *
	 * @param[out]		community as a set of nodes<commit_msg>testing merge conflicts in GreedyCommunityExpansion<commit_after>/*
 * GreedyCommunityExpansion.h
 *
 *  Created on: 03.06.2013
 *      Author: cls
 */

#ifndef GREEDYCOMMUNITYEXPANSION_H_
#define GREEDYCOMMUNITYEXPANSION_H_

#include <unordered_set>

#include "SelectiveCommunityDetector.h"


namespace NetworKit {

class GreedyCommunityExpansion: public NetworKit::SelectiveCommunityDetector {

public:

	class QualityObjective {
	public:
		Graph G;
		std::unordered_set<node>* community;

		/**
		 * @param[in]	G	the graph
		 * @param[in]	community	the currently expanding community
		 */
	public:
		QualityObjective(Graph& G, std::unordered_set<node>* community);
		virtual ~QualityObjective();
		virtual double getValue(node v) = 0;
	};

	/**
	 * LocalModularityM as a quality objective function
	 */
	class LocalModularityM : public QualityObjective {
	public:
		LocalModularityM(Graph& G, std::unordered_set<node>* community);
		virtual ~LocalModularityM();
		virtual double getValue(node v);
	};

	class Conductance : public QualityObjective {
		public:
		Conductance(Graph& G, std::unordered_set<node>* community);
			virtual ~Conductance();
			virtual double getValue(node v);
		};

	/**
	 * Acceptability measures quantify how likely a node from the community shell
	 * is to improve the community when it is included.
	 */
	class Acceptability {
	public:
		Graph G;
		std::unordered_set<node>* community;
		std::unordered_set<node>* shell;
	public:
		Acceptability(Graph& G, std::unordered_set<node>* community, std::unordered_set<node>* shell);
		virtual ~Acceptability();
		virtual double getValue(node v) = 0;
	};


	class NodeClusterSimilarity: public Acceptability {
	public:
		NodeClusterSimilarity(Graph& G, std::unordered_set<node>* community, std::unordered_set<node>* shell);
		virtual ~NodeClusterSimilarity();
		virtual double getValue(node v);
	};


	GreedyCommunityExpansion();

	virtual ~GreedyCommunityExpansion();

	/**
	 * @param[in]	G	input graph
	 * @param[in]	s	seed node
	 *
	 * @param[out]		community as a set of nodes
{'fraction_non_alphanumeric': 0.11078286558345643, 'fraction_numerical': 0.004923682914820286, 'mean_word_length': 4.931386861313869, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5431036', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1289, 'n_words': 333}