Skip to content
Open
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
13 changes: 8 additions & 5 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.Scanner;

import algorithmRunner.AlgorithmRunner;
import algorithmRunner.RunResult;
import graph.Graph;
Expand All @@ -6,6 +8,11 @@
public class Main {

public static void main(String[] args) {
Scanner s=new Scanner(System.in);
String userChoice = s.nextLine().trim().toLowerCase();
boolean labelled = userChoice.equals("yes");


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got an extra line here

String patternGraphFilepath = args[0];
String hostGraphFilepath = args[1];

Expand All @@ -15,12 +22,8 @@ public static void main(String[] args) {
hostGraphFilepath,
patternGraph,
patternGraphFilepath);
AlgorithmRunner.runAlgorithm(result, hostGraph, patternGraph);
AlgorithmRunner.runAlgorithm(result, hostGraph, patternGraph,labelled);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AlgorithmRunner.runAlgorithm(result, hostGraph, patternGraph,labelled);
AlgorithmRunner.runAlgorithm(result, hostGraph, patternGraph, labelled);

}






}
22 changes: 21 additions & 1 deletion src/main/java/algorithmRunner/AlgorithmRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,29 @@

import java.util.List;

import graph.VertexLists;

public class AlgorithmRunner {

public static void runAlgorithm(RunResult result, Graph hostGraph, Graph patternGraph) {
public static void runAlgorithm(RunResult result, Graph hostGraph, Graph patternGraph,boolean labelled) {
if (labelled) {
// If labelled, run the labelled subgraph counting algorithm
LabelledSubgraphCountingAlgorithm lSa = new LabelledSubgraphCountingAlgorithm(hostGraph, patternGraph, hostGraph.getHighestDegVertices(0));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still want to use the ParameterValueOptimiser to work out which vertices should be the high-degree vertices (see lines 44-49 below)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be useful to update RunResult so that we can say whether we counted labelled or unlabelled copies (could actually include both, since when we've counted unlabelled copies, we also know how many labelled copies there are)

int count = lSa.run();
result.setCount(count);
} else {
// If unlabelled, run both algorithms and compute the unlabelled result
LabelledSubgraphCountingAlgorithm labelledSubgraphCountingAlgorithm = new LabelledSubgraphCountingAlgorithm(hostGraph, patternGraph, hostGraph.getHighestDegVertices(0));
int A = labelledSubgraphCountingAlgorithm.run();


int B = BruteForceLabelledSubgraphCountingAlgorithm.countLabelledCopiesWithLists(patternGraph,hostGraph);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some more descriptive variable names would be helpful


int unlabelledCount = A / B;
System.out.println("Number of unlabelled copies of the subgraph: " + unlabelledCount);
result.setCount(unlabelledCount);
}


long startTime = System.currentTimeMillis();
Runtime.getRuntime().addShutdownHook(
Expand Down