gr.demokritos.iit.jinsect.structs
Class GraphSimilarity

java.lang.Object
  extended by gr.demokritos.iit.jinsect.structs.GraphSimilarity
All Implemented Interfaces:
ISimilarity
Direct Known Subclasses:
OverallGraphSimilarity, OverallNGramSimilarity

public class GraphSimilarity
extends java.lang.Object
implements ISimilarity

Class describing three aspects of similarity between graphs (mainly):


Field Summary
 double ContainmentSimilarity
          Specifies the similarity by means of co-existing nodes.
 double SizeSimilarity
          Specifies the similarity by means of size.
 double ValueSimilarity
          Specifies the similarity by means of co-existing nodes, as well as their values.
 
Constructor Summary
GraphSimilarity()
          Creates a new instance of GraphSimilarity
 
Method Summary
 double asDistance()
          Calculates an overall distance as a function of the overall similarity.
 double getOverallSimilarity()
          Calculates the overall similarity this object describes, returned as a double number.
 void setCalculator(CalculatorListener clCalc)
          Assigns a calculator of type CalculatorListener to be called when getOverallSimilarity() is called.
 double[] toArray()
          Returns a 3-element double array corresponding to the aspects of GraphSimilarity.
 float[] toFloatArray()
          Returns a 3-element float array corresponding to the aspects of GraphSimilarity.
 java.lang.String toString()
          Return a string representation of this object, describing all aspects of similarity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ValueSimilarity

public double ValueSimilarity
Specifies the similarity by means of co-existing nodes, as well as their values. Range of possible values [0, 1].0 means no node of A exists in B. 1 means all edges of A exist in B and their weights are identical.


ContainmentSimilarity

public double ContainmentSimilarity
Specifies the similarity by means of co-existing nodes. Range of possible values [0, 1].0 means no edge of A exists in B. 1 means all edges of A exist in B.


SizeSimilarity

public double SizeSimilarity
Specifies the similarity by means of size. Range of possible values [0, 1]. 1 means A has the same number of edges as B.

Constructor Detail

GraphSimilarity

public GraphSimilarity()
Creates a new instance of GraphSimilarity

Method Detail

toString

public java.lang.String toString()
Return a string representation of this object, describing all aspects of similarity.

Overrides:
toString in class java.lang.Object
Returns:
The detailed representation.

setCalculator

public void setCalculator(CalculatorListener clCalc)
Assigns a calculator of type CalculatorListener to be called when getOverallSimilarity() is called.

Parameters:
clCalc - The CalculatorListener.
See Also:
CalculatorListener

getOverallSimilarity

public double getOverallSimilarity()
Calculates the overall similarity this object describes, returned as a double number. If a calculator of type CalculatorListener has been assigned using the setCalculator method, then that calculator is used. Otherwise, the product of all aspects of GraphSimilarity is returned.

Specified by:
getOverallSimilarity in interface ISimilarity
Returns:
The overall similarity.

asDistance

public double asDistance()
Calculates an overall distance as a function of the overall similarity. This method uses the getOverallSimilarity method and returns its inverse if it has a non-zero value. Otherwise the return value is positive infinity.

Specified by:
asDistance in interface ISimilarity
Returns:
The overall distance, ranging from zero to Double.POSITIVE_INFINITY.

toArray

public double[] toArray()
Returns a 3-element double array corresponding to the aspects of GraphSimilarity.

Returns:
An array where
  • element 0 is the ValueGraphSimilarityy aspect.
  • element 1 is the ContainmentGraphSimilarityy aspect.
  • element 2 is the SizeGraphSimilarityy aspect.

toFloatArray

public float[] toFloatArray()
Returns a 3-element float array corresponding to the aspects of GraphSimilarity.

Returns:
An array where
  • element 0 is the ValueGraphSimilarityy aspect.
  • element 1 is the ContainmentGraphSimilarityy aspect.
  • element 2 is the SizeGraphSimilarityy aspect.