# Concepts¶

 Concept(**kw_args) Concept Name: Abstract Concept CptGridGraph(**kwargs) Concept Name: grid_graph CptRegionAdjacencyGraph(**kwargs) Concept Name: region_adjacency_graph CptHierarchy(**kwargs) Concept Name: hierarchy CptBinaryHierarchy(**kwargs) Concept Name: binary_hierarchy CptMinimumSpanningTree(**kwargs) Concept Name: minimum_spanning_tree
class Concept(**kw_args)[source]

Concept Name: Abstract Concept

Description: A concept describes how a set of data elements can be considered as a coherent notion of higher semantic level. One of the data elements of the concept is the canonical element of the association that can be used to materialize the concept, ie, to assemble all the data elements associated to the canonical element in order to build a representation of the higher semantic object described by the concept. Concepts are conceptually close to Classes in object oriented programming where data elements correspond to attributes. However with concepts, one never creates or manipulates actual objects: objects exist only from the relation between their data elements.

Canonical data element: The canonical element of a concept is the data that serves as a reference to retrieve all the data elements of the Concept. The canonical element is usually chosen such that there is a natural n to 1 association between the canonical element and its data elements.

Data elements:

classmethod construct(canonical_element, strict=True, data_cache=None)[source]

Tries to construct a dictionary holding all the data elements of the concept associated to the given canonical element.

Parameters
• canonical_element – an object

• strict – if True an exception is raised if all the data elements of the Concept cannot be recovered from the given canonical element, otherwise the missing data element is simply not included in the result.

• data_cache – specify a data cache where to search for data elements. If None, the default Higra global data cache is used.

Returns

a dictionary

classmethod description()[source]

Get a textual description of the Concept

Returns

a string with all the information available on the Concept

classmethod validate(canonical_element)[source]

Check if the given canonical is tagged with the given Concept (class on which the validate function is called).

Parameters

canonical_element

Returns

class CptGridGraph(**kwargs)[source]

Concept Name: grid_graph

Description: A graph whose vertices correspond to points on a regular grid.

Canonical data element: graph

Data elements:

• graph (canonical): a graph g

• shape (attribute name: ‘shape’): the shape of the underlying grid (a 1d array of positive integers such that np.prod(shape) = g.num_vertices())

static get_shape(graph)[source]

The shape (a tuple of positive integers) of the graph.

Parameters

graph

Returns

class CptRegionAdjacencyGraph(**kwargs)[source]

Description: A graph whose vertices represented super-vertices of another graph.

Canonical data element: rag

Data elements:

• rag (canonical): the region adjacency graph

• pre_graph (attribute name: ‘pre_graph’): the base graph

• vertex_map (attribute name: ‘vertex_map’): a map giving for each vertex of pre_graph the corresponding vertex of rag

• edge_map (attribute name: ‘edge_map’): a map giving for each edge of pre_graph the corresponding edge of rag (and -1 if not such edge exists)

static get_edge_map(rag)[source]

The map giving for each edge of pre_graph of the given rag, i.e. the graph the rag was built on, the corresponding edge of rag (and -1 if not such edge exists).

Parameters

rag

Returns

static get_pre_graph(rag)[source]

The graph the rag was built on.

Parameters

rag

Returns

static get_vertex_map(rag)[source]

The map giving for each vertex of pre_graph of the given rag, i.e. the graph the rag was built on, the corresponding vertex of rag.

Parameters

rag

Returns

class CptHierarchy(**kwargs)[source]

Concept Name: hierarchy

Description: A tree representing a hierarchy over a base graph.

Canonical data element: tree

Data elements:

• tree (canonical): a tree t

• leaf_graph (attribute name: ‘leaf_graph’): the graph associated to the leaves of the tree

static get_leaf_graph(tree)[source]

The graph the tree was built on, i.e. the graph associated to the leaves of the tree.

Parameters

tree

Returns

class CptBinaryHierarchy(**kwargs)[source]

Concept Name: binary_hierarchy

Description: A binary tree representing a hierarchy with an associated minimum spanning tree on the hierarchy leaf graph.

Canonical data element: tree

Data elements:

• tree (canonical): a hierarchy h

• mst (attribute name: ‘mst’): a minimum spanning tree of the leaf graph of the hierarchy

• mst_edge_map (attribute name: ‘mst_edge_map’): Map each internal vertex i of the tree to the edge ‘mst_edge_map[i - tree.num_leaves()]’ of theleaf graph of the hierarchy corresponding to a minimum spanning tree edge.

• leaf_graph (attribute name: ‘leaf_graph’): the graph associated to the leaves of the tree (inherited from CptHierarchy)

static get_mst(tree)[source]

The minimum spanning tree of the leaf graph of the hierarchy.

Parameters

tree

Returns

static get_mst_edge_map(tree)[source]

The $$mst\_edge\_map$$ of the tree is an array that maps each internal vertex $$i$$ of the tree to the edge $$mst\_edge\_map[i - tree.num_leaves()]$$ of the leaf graph of the hierarchy corresponding to a minimum spanning tree edge.

Parameters

tree

Returns

class CptMinimumSpanningTree(**kwargs)[source]

Concept Name: minimum_spanning_tree

Description: A minimum spanning tree and its base graph.

Canonical data element: mst

Data elements:

• base_graph (attribute name: ‘base_graph’): a base graph

• mst (canonical): a minimum spanning tree of the base graph

• mst_edge_map (attribute name: ‘mst_edge_map’): For each edge index i of the mst, gives the corresponding edge index in the base graph

static get_base_graph(mst)[source]

The graph on which the given mst was computed.

Parameters

mst

Returns

static get_edge_map(mst)[source]

The map that gives for each edge index i of the mst, the corresponding edge index in the base graph

Parameters

mst

Returns