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

Standardized algorithm output log #68

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws OcdAlgorithm
update(MCR, ants, nodeNr);
}


return decodeMaximalCliques(graph, nodeNr);
Cover c = decodeMaximalCliques(graph, nodeNr);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ public void setParameters(Map<String, String> parameters) throws IllegalArgument
public Cover detectOverlappingCommunities(CustomGraph graph)
throws OcdAlgorithmException, InterruptedException {
List<Node> leaders = randomWalkPhase(graph);
return labelPropagationPhase(graph, leaders);
Cover c = labelPropagationPhase(graph, leaders);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public Cover detectOverlappingCommunities(CustomGraph graph)
Map<Node, Double> leadershipValues = calculateLeadershipValues(graph, distances);
Map<Node, Integer> leaders = determineCommunityLeaders(graph, distances, leadershipValues);
Matrix memberships = calculateMemberships(graph, leaders);
return new Cover(graph, memberships);
Cover c = new Cover(graph, memberships);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws OcdAlgorithm
res.setSimCosts(opt.getCosts());
time.stop();
time.setCoverExecutionTime(res);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + res.communityCount() +" communities ***");
return res;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public Cover detectOverlappingCommunities(CustomGraph graph)
Matrix membershipMatrix = getMembershipMatrix(graph);

Cover cover = new Cover(graph, membershipMatrix);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + cover.communityCount() +" communities ***");
return cover;
}
catch(InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws OcdAlgorithm
int nodeCount = graph.nodeCount();
Matrix membershipMatrix = translateCommunityFile(LastResultPath, nodeCount);
Cover cover = new Cover(graph, membershipMatrix);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + cover.communityCount() +" communities ***");
return cover;
} catch (InterruptedException e) {
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ public Cover detectOverlappingCommunities(
/*
* Returns the cover based on the node memories.
*/
return calculateMembershipDegrees(graph, memories);
Cover c = calculateMembershipDegrees(graph, memories);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

protected void initializeCommunityDetection(CustomGraph graph, List<List<Integer>> memories, List<Node> nodeOrder) throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ public Cover detectOverlappingCommunities(CustomGraph graph)
// build the cover using the input graph and the membership matrix built above
resulting_cover = new Cover(graph,membership_matrix);

System.out.println("================== CHOSEN SOLUTION =====================");
//System.out.println("================== CHOSEN SOLUTION =====================");
System.out.println("Optimal K is: " + optimal_K + " optimal modularity is: " + modularity);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + resulting_cover.communityCount() +" communities ***");


return resulting_cover;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws InterruptedE
densestPartition = new ArrayList<Set<Edge>>(communityEdges);
}
}
return calculatePartitionCover(graph, densestPartition);
Cover c = calculatePartitionCover(graph, densestPartition);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

private Matrix calculateEdgeSimilarities(CustomGraph graph, List<Vector> linkageDegrees) throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws OcdAlgorithm
// DEBUG: System.out.println("DETECTED FINAL:" + members.values().toString());

Cover c = new Cover(graph, coverMatrix);

System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ public Cover detectOverlappingCommunities(CustomGraph graph)
int[] communities = cluster(maxLayers);

Matrix memberships = getMembershipMatrix(graph, communities);

return new Cover(graph, memberships);

Cover c = new Cover(graph, memberships);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws InterruptedE
}
double resolutionAlpha = determineResolutionAlpha(graph, inclusionAlphas, deactivatedBy, mainCommunities);
Matrix memberships = determineMembershipMatrix(graph, unactiveCommunities, deactivatedBy, inclusionAlphas, resolutionAlpha);
return new Cover(graph, memberships);
Cover c = new Cover(graph, memberships);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ public Cover detectOverlappingCommunities(CustomGraph graph)
NodeList seeds = seeding(biconnectedCore);
NodeList[] lowConductanceSets = expansion(biconnectedCore, seeds);
Matrix memberships = propagation(graph, lowConductanceSets, bridges, biconnectedCore);
return new Cover(graph, memberships);
Cover c = new Cover(graph, memberships);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

@Override
Expand Down Expand Up @@ -233,7 +235,7 @@ private NodeList seeding(Graph biconnectedCore) {
/**
* Algorithm Spread Hubs chooses an independent set of k (= seedCount) seeds by
* looking at the vertices in order of decreasing degree
* @param biconnected core
* @param biconnectedCore
* @return list of the seed nodes
*/
private NodeList spreadHubs(Graph biconnectedCore) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ public Set<GraphType> compatibleGraphTypes() {
public Cover detectOverlappingCommunities(CustomGraph graph)
throws OcdAlgorithmException, InterruptedException {
List<Node> leaders = randomWalkPhase(graph);
return labelPropagationPhase(graph, leaders);
Cover c = labelPropagationPhase(graph, leaders);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ public Set<GraphType> compatibleGraphTypes() {
public Cover detectOverlappingCommunities(CustomGraph graph) throws OcdAlgorithmException, InterruptedException {
Vector leadershipVector = getLeadershipVector(graph);
List<Node> leaders = leaderFindingPhase(graph, leadershipVector);
return labelPropagationPhase(graph, leaders, leadershipVector);
Cover c = labelPropagationPhase(graph, leaders, leadershipVector);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws OcdAlgorithm

Matrix membershipMatrix = getMembershipMatrix(graph);
Cover cover = new Cover(graph, membershipMatrix);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + cover.communityCount() +" communities ***");
return cover;
} catch (InterruptedException e) {
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public Cover detectOverlappingCommunities(
/*
* Returns the cover based on the node memories.
*/
return calculateMembershipDegrees(graph, memories);
Cover c = calculateMembershipDegrees(graph, memories);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

protected void initializeCommunityDetection(CustomGraph graph, List<List<Integer>> memories, List<Node> nodeOrder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws InterruptedE
Vector totalInfluences = executeRandomWalk(transitionMatrix);
Map<Node, Integer> leaders = determineGlobalLeaders(graph, transitionMatrix, totalInfluences);
Matrix memberships = calculateMemberships(graph, leaders);
return new Cover(graph, memberships);
Cover c = new Cover(graph, memberships);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ public Cover detectOverlappingCommunities(CustomGraph graph)
// build a community matrix with a row for each node
Matrix community_matrix = buildCoverMatrix(identified_communities, adjacency_matrix.rows());

Cover resulting_cover = new Cover(graph, community_matrix);

System.out.println("****** Number of found communities: " + identified_communities.size() + " ******");
return resulting_cover;
Cover c = new Cover(graph, community_matrix);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws InterruptedE
densestPartition = new ArrayList<Set<Edge>>(communityEdges);
}
}
return calculatePartitionCover(graph, densestPartition);
Cover c = calculatePartitionCover(graph, densestPartition);
System.out.println("*** "+ this.getClass().getSimpleName() + " found " + c.communityCount() +" communities ***");
return c;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public Cover detectOverlappingCommunities(CustomGraph graph) throws OcdAlgorithm
Cover res = new Cover(graph,membershipMatrix);
time.stop();
time.setCoverExecutionTime(res);

System.out.println("*** "+ this.getClass().getSimpleName() + " found " + res.communityCount() +" communities ***");
return res;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class Parameter {
public static int popsize = 100;
public static int T = 20;
public static int generation = 50;
public static int verbose = 2;
public static int verbose = 0;
public static double alpha = 1.0;
public static double pc = 0.7;
public static double pm = 1.0;
Expand Down