net.xqhs.graphs.matcher
Interface GraphMatchingProcess

All Known Implementing Classes:
GraphMatcherPersistent, GraphMatcherQuick

public interface GraphMatchingProcess

An implementation of this interface abstracts the matching process between a graph and a pattern (or two graph).

The graph and the pattern remain the same for the entire process. They are not expected to change over time, and if they change, the process may need to be reinitialized by using clearData().

The interface offers methods to enable incremental matching, moving between matches of a specified k (number of edges in the pattern missing from the matched part of the pattern). The k is specified by a call to resetIterator(int) and is 0 by default.

The implementation should act as an iterator, using getNextMatch() to advance to the next match of k equal to the threshold or lower.

The two additional methods that retrieve all matches reset the iterator as well.

It is recommended that implementations keep any information related to the matching process (such as intermediate matches) that could help improve performance of future queries. Memory occupied by this information should be clear if clearData() is invoked.

Author:
Andrei Olaru

Method Summary
 GraphMatchingProcess clearData()
          Clears all data related to the matching process.
 java.util.List<Match> getAllCompleteMatches()
          The method returns all complete matches.
 java.util.List<Match> getAllMatches(int k)
          The method returns all matches with a k lower than or equal to the argument.
 java.util.List<Match> getBestMatches()
          The method creates all matches and returns the set of matches with the best (lowest) k.
 Match getNextMatch()
          Searches for the next match with a k lower than or equal to the current threshold.
 GraphMatchingProcess resetIterator()
          Resets the iterator.
 GraphMatchingProcess resetIterator(int k)
          Resets the iterator (see resetIterator()) and specifies a new k threshold.
 

Method Detail

resetIterator

GraphMatchingProcess resetIterator()
Resets the iterator. The next call to getNextMatch() will return the first match conforming to the current k threshold.

Returns:
the instance itself.

resetIterator

GraphMatchingProcess resetIterator(int k)
Resets the iterator (see resetIterator()) and specifies a new k threshold.

Parameters:
k - - the new threshold.
Returns:
the instance itself.

clearData

GraphMatchingProcess clearData()
Clears all data related to the matching process.

The call to this method results in freeing all memory occupied by information related to the matching process that was retained.

Returns:
the instance itself.

getNextMatch

Match getNextMatch()
Searches for the next match with a k lower than or equal to the current threshold. The match returned is the first match that was not previously returned after the last call to resetIterator().

Depending on implementation, if no initialization has been done prior to this call (after constructing the instance or after a call to clearData()), the first call to this method should also make all initializations in the matching process.

If intermediate matches are kept during the matching process, and clearData() was not invoked, this method may return faster, if the desired match has already been generated partially or entirely.

As the matching process is a complex one, a call to this method is expected to be time consuming, depending on implementation and existing matching information.

Returns:
the first match that was not previously returned after the last call to resetIterator().

getAllMatches

java.util.List<Match> getAllMatches(int k)
The method returns all matches with a k lower than or equal to the argument.

Performance of a call will be influenced by existing matching information.

Parameters:
k - - the threshold.
Returns:
a List of matches complying with the threshold.

getAllCompleteMatches

java.util.List<Match> getAllCompleteMatches()
The method returns all complete matches.

Performance of a call will be influenced by existing matching information.

Returns:
a List of complete matches of the pattern in the graph.

getBestMatches

java.util.List<Match> getBestMatches()
The method creates all matches and returns the set of matches with the best (lowest) k. If any complete matches exist, the returned list will contain all complete matches.

Returns:
a List with the matches of lowest k.