-
Notifications
You must be signed in to change notification settings - Fork 1
initial commit #3
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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; | ||||||
|
|
@@ -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"); | ||||||
|
|
||||||
|
|
||||||
| String patternGraphFilepath = args[0]; | ||||||
| String hostGraphFilepath = args[1]; | ||||||
|
|
||||||
|
|
@@ -15,12 +22,8 @@ public static void main(String[] args) { | |||||
| hostGraphFilepath, | ||||||
| patternGraph, | ||||||
| patternGraphFilepath); | ||||||
| AlgorithmRunner.runAlgorithm(result, hostGraph, patternGraph); | ||||||
| AlgorithmRunner.runAlgorithm(result, hostGraph, patternGraph,labelled); | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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)); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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( | ||
|
|
||
There was a problem hiding this comment.
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