konnektor.network_analysis#

konnektor.network_analysis.network_analysis.get_component_connectivities(ligand_network: LigandNetwork, normalize: bool = False) dict[SmallMoleculeComponent, float | int]#

Calculate the connectivities for all nodes in the graph.

Parameters:

ligand_network (LigandNetwork)

Returns:

node id and corresponding connectivity

Return type:

dict[int, int]

konnektor.network_analysis.network_analysis.get_component_number_cycles(ligand_network: LigandNetwork, higher_bound: int = 4) dict[int, int]#

Get for each node the number of cycles, the node is contained in.

Parameters:
  • ligand_network (LigandNetwork)

  • higher_bound (int, optional) – largest number of nodes contained in one searched cycle.

Returns:

node index with number of cycles.

Return type:

dict[int, int]

konnektor.network_analysis.network_analysis.get_component_scores(ligand_network: LigandNetwork, normalize: bool = True) dict[SmallMoleculeComponent, float]#

Calculate the score of a node, as the sum of the edge scores. :param ligand_network: :type ligand_network: LigandNetwork :param normalize: :type normalize: bool, optional

Returns:

node index with value as node score.

Return type:

dict[int, float]

konnektor.network_analysis.network_analysis.get_is_connected(ligand_network: LigandNetwork) bool#

Check if the Ligand Network graph is connected.

Parameters:

ligand_network (LigandNetwork)

Returns:

if the Ligand Network graph is connected

Return type:

bool

konnektor.network_analysis.network_analysis.get_network_cost(ligand_network: LigandNetwork) float#

Calculate the graph score based on summation of the edge weights.

Parameters:

ligand_network (LigandNetwork) – ligand network, that should return the graph score.

Returns:

sum of all edges the graph score

Return type:

float

konnektor.network_analysis.network_analysis.get_network_efficiency(ligand_network: LigandNetwork) float#

Calculate the graph score based on summation of the edge weights.

Parameters:

ligand_network (LigandNetwork) – ligand network, that should return the graph score.

Returns:

sum of all edges the graph score

Return type:

float

konnektor.network_analysis.network_analysis.get_network_score(ligand_network: LigandNetwork) float#

Calculate the graph score based on summation of the edge weights.

Parameters:

ligand_network (LigandNetwork) – ligand network, that should return the graph score.

Returns:

sum of all edges the graph score

Return type:

float

konnektor.network_analysis.network_analysis.get_number_of_network_cycles(ligand_network: LigandNetwork, higher_bound: int = 3) int#

Calculate the graph cycles, upt to the upper bound.

Parameters:
  • ligand_network (LigandNetwork)

  • higher_bound (int) – largest number of nodes in cycle.

Returns:

number of counted cycles.

Return type:

int

konnektor.network_analysis.network_analysis.get_transformation_failure_robustness(ligand_network: LigandNetwork, failure_rate: float = 0.05, nrepeats: int = 100, seed: int | None = None) float#

Estimate the robustness of a LigandNetwork, by removing n edges, corresponding to the percentage given by the failure_rate. This process is randomly repeated nrepeat times. The result is the average of the repeats, between 0 (was always disconnected) and 1 (never was disconnected).

Parameters:
  • ligand_network (LigandNetwork)

  • failure_rate (float, optional) – failure rate of edges, default 0.05 i.e. 5%

  • nrepeats (int, optional) – how often shall the process be sampled.

  • seed (int, optional) – seed the random process, useful for replicating results or testing

Returns:

returns the probability that the network remained connected after removing failed edges, between 0.0 (indicating the network was always disconnected) and 1.0 (network was never disconnected)

Return type:

float