Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract Link Analysis Ranking computation from ActivityGraph #73

Open
github-actions bot opened this issue Jun 27, 2020 · 0 comments
Open

Extract Link Analysis Ranking computation from ActivityGraph #73

github-actions bot opened this issue Jun 27, 2020 · 0 comments
Labels
enhancement New feature or request project:library Issues related to the prefetch library for Android

Comments

@github-actions
Copy link

github-actions bot commented Jun 27, 2020

The computation of Link Analysis Ranking (LAR) rankings in this class add cluster, difficult the implementation of plug-and-play components and reduce the source readability.

The following strategies run their calculations here

  • PageRank
  • PageRank + Greedy
  • HITS
  • HITS + PPM
  • SALSA

Extracting the management of LAR data from this class will largely increase its readability.
While performing the extraction, an aspect to consider is that the implemented algorithms run the scores for all activities in the graph and runs a single interaction only.

Take the method updateNodes as an example:

public boolean updateNodes(String activityName) {
boolean shouldPrefetch = false;
float dump = 0.85f;
float initialPageRank = 0.25f;
float initialAuthority = 1f;
float initialHub = 1f;
float initialAuthorityS = 1f;
float initialHubS = 1f;
ActivityNode temp = new ActivityNode(activityName);
// verify if this activity has already been added to the graph
final String tempActivityName = temp.activityName;
if (nodeList.contains(temp)) {
temp = nodeList.get(nodeList.lastIndexOf(temp));
} else {
temp.pageRank = initialPageRank;
temp.authority = initialAuthority;
temp.hub = initialHub;
temp.authorityS = initialAuthorityS;
temp.hubS = initialHubS;
nodeList.add(temp);
poolExecutor.schedule(() -> {
NappaDB.getInstance().activityDao().insertLAR(new LARData(tempActivityName, initialPageRank, initialAuthority, initialHub, initialAuthorityS, initialHubS));
}, 0, TimeUnit.SECONDS);
Log.d(LOG_TAG, "LARDataUpdate " + "node " + temp.activityName + " added to nodelist");
Log.d(LOG_TAG, "LARDataUpdate " + " Pagerank: " + temp.pageRank + " HITS-Authority: " + temp.authority + " HITS-Hub: " + temp.hub + " SALSA-Authority: " + temp.authorityS + " SALSA-Hub: " + temp.hubS);
}
if (current != null) {
shouldPrefetch = current.addSuccessor(temp);
nodeList.set(nodeList.lastIndexOf(temp), temp);
//updates
updateLAR(activityName);
temp = nodeList.get(nodeList.lastIndexOf(temp));
Log.d(LOG_TAG, "LARDataCalculatedUpdate " + temp.activityName + " Pagerank: " + temp.pageRank + " HITS-Authority: " + temp.authority + " HITS-Hub: " + temp.hub + " SALSA-Authority: " + temp.authorityS + " SALSA-Hub: " + temp.hubS);
}
current = temp;
return shouldPrefetch;
}

Without LARs operations and doing a cleanup, this method would be something like:

    public boolean updateNodes(String activityName) {
        boolean shouldPrefetch = false;
        ActivityNode node = new ActivityNode(activityName);

        // verify if this activity has already been added to the graph
        int nodeIdx = nodeList.lastIndexOf(node);
        if (nodeIdx != -1) node = nodeList.get(nodeIdx);
        else nodeList.add(node);
        
        if (current != null) {
            shouldPrefetch = current.addSuccessor(node);
            if (nodeIdx == -1) nodeIdx = nodeList.size() - 1;
            nodeList.set(nodeIdx, node);
        }
        current = node;
        
        return shouldPrefetch;
    }
@github-actions github-actions bot added the todo label Jun 27, 2020
@sshann sshann added enhancement New feature or request project:library Issues related to the prefetch library for Android labels Jun 29, 2020
@sshann sshann changed the title Extract LAR operations from class ActivityGraph Extract Link Analysis Ranking computation from ActivityGraph Aug 29, 2020
@sshann sshann removed the todo label Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request project:library Issues related to the prefetch library for Android
Projects
None yet
Development

No branches or pull requests

1 participant