private RunningLog log;
public ComparisonResult compare(Graph g1, Graph g2) {
super.clearLog();
this.log = super.getLog();
ComparisonResult simpleCompareResult = super.compare(g1, g2);
if (! simpleCompareResult.comparisonSucceeded()) {
return simpleCompareResult;
}
log.append(simpleCompareResult.getLog());
if (! nodeDegreeFrequenciesEqual(g1, g2)) {
log.prepend("The number of nodes" +
"with a certain number of edges is not the same in" +
"both graphs.");
return new ComparisonResult(false, log);
}
/*
* TODO: we could really use a graph isomorphism comparison right
* here. nodeDegreeFrequencies will catch some errors, but lets
* a lot through.
*/
if (! haveSameNodeAttributes(g1, g2)) {
log.prepend("Node attributes are not " +
"the same in both graphs.");
return new ComparisonResult(false, log);
}
if (! haveSameEdgeAttributes(g1, g2)) {
log.prepend("Edge attributes are not " +
"the same in both graphs.");
return new ComparisonResult(false, log);
}
//all tests passed
log.prepend("All comparison tests succeeded");
return new ComparisonResult(true, log);
}