API Documentation

class cliquematch.Graph
use_heuristic

Search using the heuristic if true

Type

bool

use_dfs

Perform the depth-first search if true

Type

bool

lower_bound

Set the lower bound on the size of clique to find

Type

int

upper_bound

Set the upper bound on the size of clique to find

Type

int

time_limit

Set the time limit on the search

Type

float

current_vertex

The vertex which is about to be searched (Readonly)

Type

int

search_done

Whether the search has been completed (Readonly)

Type

bool

n_vertices

Number of vertices in the graph (Readonly)

Type

int

n_edges

Number of edges in the graph (Readonly)

Type

int

get_max_clique()

Finds a maximum clique in graph within the given bounds

Returns

the vertices in the maximum clique

Return type

list

Continue the clique search if the entire graph has not been searched

Reset the search for maximum cliques

static from_file()

Constructs Graph instance from reading a Matrix Market file

Parameters

str – filename

Returns

the loaded Graph

static from_edgelist()

Constructs Graph instance from the given edge list

Param

edgelist (numpy.ndarray of shape (n,2))

Parameters

int – num_vertices

Returns

the loaded Graph

static from_matrix()

Constructs Graph instance from the given boolean adjacency matrix

Param

adjmat (numpy.ndarray, bool square matrix)

Returns

the loaded Graph

static from_adjlist()

Constructs Graph instance from the given adjacency list

Parameters
  • int – num_vertices

  • int – num_edges

  • list – edges

Returns

the loaded Graph

to_file()

Exports Graph instance to a Matrix Market file

Parameters

str – filename

to_edgelist()

Exports Graph instance to an edge list

Returns

(n,2) numpy.ndarray of edges

to_matrix()

Exports Graph instance to a boolean matrix

Returns

square numpy.ndarray of bools

to_adjlist()

Exports Graph instance to an adjacency list

Returns

list of sets

class cliquematch.A2AGraph(set1, set2, d1=None, d2=None, is_d1_symmetric=True, is_d2_symmetric=True)

Correspondence Graph wrapper for array-to-array mappings.

S1

array elements are converted to numpy.float64

Type

numpy.ndarray

S2

array elements are converted to numpy.float64

Type

numpy.ndarray

d1

distance metric for elements in S1, defaults to Euclidean metric if None.

Type

callable (numpy.ndarray, int, int) -> float

d2

distance metric for elements in S2, defaults to Euclidean metric if None

Type

callable (numpy.ndarray, int, int) -> float

is_d1_symmetric
Type

bool

is_d2_symmetric
Type

bool

build_edges()

Build edges of the correspondence graph using distance metrics.

Checks d1 and d2 for defaults before passing to base class.

build_edges_with_condition(condition_func, use_cfunc_only)

Build edges of the correspondence graph using a given condition function.

Parameters
  • condition_func (callable) – must take parameters corresponding to S1, int, int, S2, int, int, and return bool

  • use_cfunc_only (bool) – if True, the distance metrics will not be used to filter out edges (slower)

Returns

True if construction was successful

get_correspondence(return_indices=True)

Get corresponding subsets between the S1 and S2.

Parameters

return_indices (bool) – if True return the indices of the corresponding elements, else return the elements

class cliquematch.L2LGraph(set1, set2, d1=None, d2=None, is_d1_symmetric=True, is_d2_symmetric=True)

Correspondence Graph wrapper for list-to-list mappings.

Any object can be passed for S1 and S2; the user is required to define how the elements are accessed.

S1

array elements are converted to numpy.float64

Type

object

S2

array elements are converted to numpy.float64

Type

object

d1

distance metric for elements in S1

Type

callable (list, int, int) -> float

d2

distance metric for elements in S2

Type

callable (list, int, int) -> float

is_d1_symmetric
Type

bool

is_d2_symmetric
Type

bool

build_edges()

Build edges of the correspondence graph using distance metrics.

Checks d1 and d2 for defaults before passing to base class.

build_edges_with_condition(condition_func, use_cfunc_only)

Build edges of the correspondence graph using a given condition function.

Parameters
  • condition_func (callable) – must take parameters corresponding to S1, int, int, S2, int, int, and return bool

  • use_cfunc_only (bool) – if True, the distance metrics will not be used to filter out edges (slower)

Returns

True if construction was successful

get_correspondence(return_indices=True)

Get corresponding subsets between the S1 and S2.

Parameters

return_indices (bool) – if True return the indices of the corresponding elements, else return the elements

class cliquematch.L2AGraph(set1, set2, d1=None, d2=None, is_d1_symmetric=True, is_d2_symmetric=True)

Correspondence Graph wrapper for list-to-array mappings.

Any general object can be passed for S1; the user is required to define how elements are accessed.

S1
Type

object

S2

array elements are converted to numpy.float64

Type

numpy.ndarray

d1

distance metric for elements in S1

Type

callable (list, int, int) -> float

d2

distance metric for elements in S2, defaults to Euclidean metric if None

Type

callable (numpy.ndarray, int, int) -> float

is_d1_symmetric
Type

bool

is_d2_symmetric
Type

bool

build_edges()

Build edges of the correspondence graph using distance metrics.

Checks d1 and d2 for defaults before passing to base class.

build_edges_with_condition(condition_func, use_cfunc_only)

Build edges of the correspondence graph using a given condition function.

Parameters
  • condition_func (callable) – must take parameters corresponding to S1, int, int, S2, int, int, and return bool

  • use_cfunc_only (bool) – if True, the distance metrics will not be used to filter out edges (slower)

Returns

True if construction was successful

get_correspondence(return_indices=True)

Get corresponding subsets between the S1 and S2.

Parameters

return_indices (bool) – if True return the indices of the corresponding elements, else return the elements

class cliquematch.A2LGraph(set1, set2, d1=None, d2=None, is_d1_symmetric=True, is_d2_symmetric=True)

Correspondence Graph wrapper for array-to-list mappings.

Any general object can be passed for S2; the user is required to define how elements are accessed.

S1

array elements are converted to numpy.float64

Type

numpy.ndarray

S2
Type

object

d1

distance metric for elements in S1, defaults to Euclidean metric if None

Type

callable (numpy.ndarray, int, int) -> float

d2

distance metric for elements in S2

Type

callable (list, int, int) -> float

is_d1_symmetric
Type

bool

is_d2_symmetric
Type

bool

build_edges()

Build edges of the correspondence graph using distance metrics.

Checks d1 and d2 for defaults before passing to base class.

build_edges_with_condition(condition_func, use_cfunc_only)

Build edges of the correspondence graph using a given condition function.

Parameters
  • condition_func (callable) – must take parameters corresponding to S1, int, int, S2, int, int, and return bool

  • use_cfunc_only (bool) – if True, the distance metrics will not be used to filter out edges (slower)

Returns

True if construction was successful

get_correspondence(return_indices=True)

Get corresponding subsets between the S1 and S2.

Parameters

return_indices (bool) – if True return the indices of the corresponding elements, else return the elements

class cliquematch.IsoGraph(set1, set2)

Correspondence graph for finding subgraph isomorphisms.

S1
Type

cliquematch.Graph

S2
Type

cliquematch.Graph

build_edges()

Build edges of the correspondence graph.

get_correspondence(return_indices=True)

Obtain corresponding vertices in the subgraph isomorphism.

Parameters

return_indices (bool) – if False will the return a tuple of 3 dict s: the subgraph of S1, the subgraph S2, a mapping from the vertices of S1 to S1

Returns

list or tuple (see above).

class cliquematch.AlignGraph(set1, set2)

Correspondence graph for aligning images using obtained interest points.

Uses a mask-based filtering method as a conditon function during construction of the graph. Default Euclidean metrics are used as distance metrics.

S1

array elements are converted to numpy.float64

Type

numpy.ndarray

S2

array elements are converted to numpy.float64

Type

numpy.ndarray

build_edges_with_filter(control_points, filter_mask, percentage)

Uses control points and a binary mask to filter out invalid mappings and construct a correspondence graph.

Parameters
  • control_points (numpy.ndarray) – control points to use in every alignment test

  • filter_mask (numpy.ndarray) – a boolean mask showing valid regions in the target image

  • percentage (float) – an alignment is valid if the number of control points that fall within the mask are greater than this value

get_correspondence(return_indices=False)

Find correspondence between the sets of points S1 and S2.

Parameters

return_indices (bool) – if True, returns only indices, else the below dict

Returns

dict of the two sets of corresponding points and the rotation/translation required to transform S1 to S2 (obtained via Kabsch Algorithm)