Reference¶
mgtoolkit API¶
-
class
mgtoolkit.library.
ConditionalMetagraph
(variables_set, propositions_set)[source]¶ Represents a conditional metagraph that is instantiated using a set of variables and a set of propositions.
-
add_edges_from
(edge_list)[source]¶ Adds the given list of edges to the conditional metagraph. :param edge_list: list of Edge objects :return: None
-
edge_attributes_conflict
(potential_conflicts_set, intersecting_attr_set)[source]¶ Checks if given edge attributes conflict. :param potential_conflicts_set: set :return: boolean
-
static
get_actions
(attributes)[source]¶ Filters the given list of attributes and returns a list of action-attribute values. :param attributes: list :return: list of strings
-
get_all_metapaths
()[source]¶ Retrieves all metapaths in the conditional metagraph. :return: List of Metapath objects
-
get_all_metapaths_from
(source, target, prop_subset=None)[source]¶ Retrieves all metapaths between given source and target in the conditional metagraph. :param source: set :param target: set :return: list of Metapath objects
-
get_context
(true_propositions, false_propositions)[source]¶ Retrieves the context metagraph for the given true and false propositions. :param true_propositions: set :param false_propositions: set :return: ConditionalMetagraph object
-
get_projection
(variables_subset)[source]¶ Gets the conditional metagraph projection for a subset of its variable set. :param variables_subset: set :return: Metagraph object
-
has_conflicts
(metapath)[source]¶ Checks whether the given metapath has any conflicts. :param metapath: Metapath object :return: boolean
-
has_redundancies
(metapath)[source]¶ Checks if given metapath has redundancies. :param metapath: Metapath object :return: boolean
-
is_connected
(source, target, logical_expressions, interpretations)[source]¶ Checks if subset1 is connected to subset2. :param source: set :param target: set :param logical_expressions: list of strings :param interpretations: lists of tuples :return: boolean
-
is_fully_connected
(source, target, logical_expressions, interpretations)[source]¶ Checks if subset1 is fully connected to subset2. :param source: set :param target: set :param logical_expressions: list of strings :param interpretations: lists of tuples :return: boolean
-
-
class
mgtoolkit.library.
Edge
(invertex, outvertex, attributes=None, label=None)[source]¶ Represents a metagraph edge.
-
class
mgtoolkit.library.
Metagraph
(generator_set)[source]¶ Represents a metagraph.
-
add_edge
(edge)[source]¶ Adds the given edge to the metagraph. :param edge: Edge object :return: None
-
add_edges_from
(edge_list)[source]¶ Adds the given list of edges to the metagraph. :param edge_list: list of Edge objects :return: None
-
add_metagraph
(metagraph2)[source]¶ Adds the given metagraph to current and returns the composed result. :param metagraph2: Metagraph object :return: Metagraph object
-
add_nodes_from
(nodes_list)[source]¶ Adds nodes from the given list to the metagraph. :param nodes_list: list of Node objects :return: None
-
adjacency_matrix_old
()[source]¶ Returns the adjacency matrix of the metagraph. :return: numpy.matrix
-
dominates
(metagraph2)[source]¶ Checks if the metagraph dominates that provided. :param metagraph2: Metagraph object :return: boolean
-
equivalent
(metagraph2)[source]¶ Checks if current metagraph is equivalent to the metagraph provided. :param metagraph2: Metagraph object :return: boolean
-
get_all_metapaths_from
(source, target)[source]¶ Retrieves all metapaths between given source and target in the metagraph. :param source: set :param target: set :return: list of Metapath objects
-
get_closure
()[source]¶ Returns the closure matrix (i.e., A*) of the metagraph. :return: numpy.matrix
-
static
get_coinputs
(edge, x_i)[source]¶ Returns the set of co-inputs for element x_i in the given edge. :param edge: Edge object :param x_i: invertex element :return: set
-
static
get_cooutputs
(edge, x_j)[source]¶ Returns the set of co-outputs for element x_j in the given edge. :param edge: Edge object :param x_j: outvertex element :return: set
-
get_edges
(invertex, outvertex)[source]¶ Retrieves all edges between a given invertex and outvertex. :param invertex: set :param outvertex: set :return: list of Edge objects.
-
get_efm
(generator_subset)[source]¶ Gets the element-flow metagraph. :param generator_subset: set :return: Metagraph object
-
get_minimal_cutset
(source, target)[source]¶ Retrieves the minimal cutset between a given source and target. :param source: set :param target: set :return: list of Edge objects
-
get_projection
(generator_subset)[source]¶ Gets the metagraph projection for a subset of the generating set. :param generator_subset: set :return: Metagraph object
-
incidence_matrix
()[source]¶ Gets the metagraph projection for a subset of the generating set. :return: numpy.matrix
-
is_bridge
(edge_list, source, target)[source]¶ Checks if a given edge list forms a bridge between a source and a target. :param edge_list: list of Edge objects :param source: set :param target: set :return: boolean
-
is_cutset
(edge_list, source, target)[source]¶ Checks if an edge list is a cutset between a given source and target. :param edge_list: list of Edge objects :param source: set :param target: set :return: boolean
-
is_dominant_metapath
(metapath)[source]¶ Checks if the given metapath is a dominant metapath. :param metapath: Metapath object :return: boolean
-
is_edge_dominant_metapath
(metapath)[source]¶ Checks if the given metapath is an edge-dominant metapath. :param metapath: Metapath object :return: boolean
-
is_input_dominant_metapath
(metapath)[source]¶ Checks if the given metapath is an input-dominant metapath. :param metapath: Metapath object :return: boolean
-
is_metapath
(metapath_candidate)[source]¶ Checks if the given candidate is a metapath. :param metapath_candidate: Metapath object :return: boolean
-
is_redundant_edge
(edge, metapath, source, target)[source]¶ Checks if the given edge is redundant for the given metapath. :param edge: Edge object :param metapath: Metapath object :param source: set :param target: set :return: boolean
-
multiply_metagraph
(metagraph2)[source]¶ Multiplies the metagraph with that provided and returns the result. :param metagraph2: Metagraph object :return: Metagraph object
-
remove_edge
(edge)[source]¶ Removes the given edge from the metagraph. :param edge: Edge object :return:None
-
remove_edges_from
(edge_list)[source]¶ Removes edges from the given list from the metagraph. :param edge_list: list of Edge objects :return: None
-
-
class
mgtoolkit.library.
Metapath
(source, target, edge_list)[source]¶ Represents a metapath between a source and a target node in a metagraph.