My Project
|
Public Member Functions | |
Map< KnowledgeField, CommonKnowledgeData > | getKnowledgeFields () |
void | updateField (KnowledgeField kf, int delta_n) |
int | getNumInstancesOfField (KnowledgeField kf) |
double | getPerformance (KnowledgeField kf) |
void | updatePerformance () |
Private Member Functions | |
boolean | containsKF (KnowledgeField kf) |
KnowledgeField | getAlterEgo (KnowledgeField kf) |
void | computeRandomPerformance () |
void | computeBetweenness () |
int | setupGraphAndGetNumCN (UndirectedSparseGraph graph) |
Private Attributes | |
HashMap< KnowledgeField, CommonKnowledgeData > | knowledgeFields |
boolean | mapsChanged |
Contains the number of instances of each knowledge field. Contains a method to compute betweeness centrality.
|
inlineprivate |
Computes the Betweeness Centrality. Employs the library http://jung.sourceforge.net. Based on: Ulrik Brandes, "A Faster Algorithm for Betweeness Centrality". Journal of Mathematical Sociology, 25(2): 163-177, 2001.
See original paper: http://www.algo.uni-konstanz.de/publications/b-fabc-01.pdf
In graph theory, betweenness centrality is a measure of centrality in a graph based on shortest paths. For every pair of vertices in a connected graph, there exists at least one shortest path between the vertices such that either the number of edges that the path passes through (for unweighted graphs) or the sum of the weights of the edges (for weighted graphs) is minimized. The betweenness centrality for each vertex is the number of these shortest paths that pass through the vertex.
Read more here: https://en.wikipedia.org/wiki/Betweenness_centrality
Computes betweenness centrality for each vertex and edge in the graph. The result is that each vertex and edge has a UserData element of type MutableDouble whose key is 'centrality.BetweennessCentrality'. Note: Many social network researchers like to normalize the betweenness values by dividing the values by (n-1)(n-2)/2. The values given here are unnormalized.
|
inlineprivate |
Computes random performance.
|
inlineprivate |
Tells whether the map 'knowledgeFields' contains a specific knowledge field. One cannot rely on the in-built method 'containsKey()' because it is based on knowledge fields hashcodes. We want to check whether a knowledge field is there, which has the same BEIs of another knowledge field. If it does, its ID must be changed because it must be the same knowledge field for us.
kf |
|
inlineprivate |
Same procedure as 'containsKey' above, but the knowledge field is returned, which has the same BEIs as kf albeit (for the moment) a different ID.
kf |
|
inline |
Gets the whole tree of knowledge fields.
|
inline |
Gets the number of instances of a given field. Called by Model. If the field is not there, it returns zero.
kf |
|
inline |
CommonKnowledge may have stored a different knowledge field, entailing the same BEIs.
kf |
|
inlineprivate |
Set up graph, adding nodes and edges. Return size of connected nodes.
graph | UndirectedSparseGraph |
|
inline |
It updates the number of instances of a knowledge field. It takes care that the calling knowledge field is eventually renamed as an instance of another knowledge field. This method works with delta_n <= 1, but it is called with delta_n = +-1. With delta_n = 1 the calling knowledge field is eventually renamed. (ONLY the calling knowledge field is renamed, that's why it doesn't work with delta_n > 1). In delta_n < 0 renaming is not necessary because the calling field(s) will be destroyed. If it is asked to update to a non-positive number of instances, it deletes the knowledge field.
kf | |
delta_n |
|
inline |
Updates performance if the set of knowledge fields changed. Performance is computed according to the algorithm specified by originOfPerformance.
|
private |
Common knowledge is made of items composed by a knowledge field, the number of instances there are of it, and the performance it provides. It is organized as a hashmap with Key: KnowledgeField, and Value: CommonKnowledgeData, where CommonKnowledgeData is composed of the number of instances of this knowledge field and its performance.
|
private |
Whether the above map changed. It is set to 'true' by updateField and it is set to 'false' by updatePerformance.