network_graph module

class network_graph.NetworkGraph(graph_struct: structure.Structure)

Bases: object

Abstracts the infos contained in the Structure class in the form of a directed graph. Has the task of creating all the necessary filtering and indexing structures for parameters estimation

Parameters

graph_struct (Structure) – the Structure object from which infos about the net will be extracted

_graph

directed graph

_aggregated_info_about_nodes_parents

a structure that contains all the necessary infos about every parents of the node of which all the indexing and filtering structures will be constructed.

_time_scalar_indexing_structure

the indexing structure for state res time estimation

_transition_scalar_indexing_structure

the indexing structure for transition computation

_time_filtering

the columns filtering structure used in the computation of the state res times

_transition_filtering

the columns filtering structure used in the computation of the transition from one state to another

_p_combs_structure

all the possible parents states combination for the node of interest

add_edges(list_of_edges: List) → None

Add the edges to the _graph contained in the list list_of_edges.

Parameters

list_of_edges (List) – the list containing of tuples containing the edges

add_nodes(list_of_nodes: List) → None

Adds the nodes to the _graph contained in the list of nodes list_of_nodes. Sets all the properties that identify a nodes (index, positional index, cardinality)

Parameters

list_of_nodes (List) – the nodes to add to _graph

build_p_comb_structure_for_a_node(parents_values: List) → numpy.ndarray

Builds the combinatorial structure that contains the combinations of all the values contained in parents_values.

Parameters

parents_values (List) – the cardinalities of the nodes

Returns

A numpy matrix containing a grid of the combinations

Return type

numpy.ndArray

build_time_columns_filtering_for_a_node(node_indx: int, p_indxs: List) → numpy.ndarray

Builds the necessary structure to filter the desired columns indicated by node_indx and p_indxs in the dataset. This structute will be used in the computation of the state res times. :param node_indx: the index of the node :type node_indx: int :param p_indxs: the indexes of the node’s parents :type p_indxs: List :return: The filtering structure for times estimation :rtype: numpy.ndArray

build_time_scalar_indexing_structure_for_a_node(node_id: str, parents_vals: List) → numpy.ndarray

Builds an indexing structure for the computation of state residence times values.

Parameters
  • node_id (string) – the node label

  • parents_vals (List) – the caridinalites of the node’s parents

Returns

The time indexing structure

Return type

numpy.ndArray

build_transition_filtering_for_a_node(node_indx: int, p_indxs: List) → numpy.ndarray

Builds the necessary structure to filter the desired columns indicated by node_indx and p_indxs in the dataset. This structure will be used in the computation of the state transitions values. :param node_indx: the index of the node :type node_indx: int :param p_indxs: the indexes of the node’s parents :type p_indxs: List :return: The filtering structure for transitions estimation :rtype: numpy.ndArray

build_transition_scalar_indexing_structure_for_a_node(node_id: str, parents_vals: List) → numpy.ndarray

Builds an indexing structure for the computation of state transitions values.

Parameters
  • node_id (string) – the node label

  • parents_vals (List) – the caridinalites of the node’s parents

Returns

The transition indexing structure

Return type

numpy.ndArray

property edges
fast_init(node_id: str) → None

Initializes all the necessary structures for parameters estimation of the node identified by the label node_id

Parameters

node_id (string) – the label of the node

get_node_indx(node_id) → int
get_ordered_by_indx_set_of_parents(node: str) → Tuple

Builds the aggregated structure that holds all the infos relative to the parent set of the node, namely (parents_labels, parents_indexes, parents_cardinalities).

Parameters

node (string) – the label of the node

Returns

a tuple containing all the parent set infos

Return type

Tuple

get_parents_by_id(node_id) → List

Returns a list of labels of the parents of the node node_id

Parameters

node_id (string) – the node label

Returns

a List of labels of the parents

Return type

List

get_positional_node_indx(node_id) → int
get_states_number(node_id) → int
property nodes
property nodes_indexes
property nodes_values
property p_combs
property time_filtering
property time_scalar_indexing_strucure
property transition_filtering
property transition_scalar_indexing_structure