modelgraph package

Submodules

modelgraph.cli module

modelgraph.dependency_graph module

class modelgraph.dependency_graph.DependencyGraph(ode: ODE)[source]

Bases: object

dependency_graph(name: str) DiGraph[source]

Get the dependency graph where each node reperesents an expression and a directed edge means that there is a dependency.

There will be a directed edge from the root node to another node if the root node is a dependency of the other node.

Parameters:

name (str) – Name of the root node

Returns:

A directed dependency graph

Return type:

nx.DiGraph

property dependent_names: list[str]

Return all the names of the expressions having dependencies

Returns:

List of names

Return type:

list[str]

dependents(name: str, direct: bool = True) set[str][source]

Given a name of an expression return its dependencies

Parameters:
  • name (str) – Name of the expression

  • direct (bool, optional) – Whether to return only direct depenencies or also include indirect dependencies, by default True

Returns:

Set of names of all dependencies

Return type:

set[str]

inv_dependency_graph(name: str)[source]

Get the dependency graph where each node reperesents an expression and a directed edge means that there is a dependency.

There will be a directed edge from the root node to another node if the root node depends on the other node.

Parameters:

name (str) – Name of the root node

Returns:

A directed dependency graph

Return type:

nx.DiGraph

property inv_dependent_names: list[str]

Return all the names of the expressions that other expressions depdens on

Returns:

List of names

Return type:

list[str]

inv_dependents(name: str, direct: bool = True) set[str][source]

Given a name of an expression return all expressions that depends on it

Parameters:
  • name (str) – Name of the expression

  • direct (bool, optional) – Whether to return only direct depenencies or also include indirect dependencies, by default True

Returns:

Set of names of all dependencies

Return type:

set[str]

property ode: ODE

Return the ode

Module contents

class modelgraph.DependencyGraph(ode: ODE)[source]

Bases: object

dependency_graph(name: str) DiGraph[source]

Get the dependency graph where each node reperesents an expression and a directed edge means that there is a dependency.

There will be a directed edge from the root node to another node if the root node is a dependency of the other node.

Parameters:

name (str) – Name of the root node

Returns:

A directed dependency graph

Return type:

nx.DiGraph

property dependent_names: list[str]

Return all the names of the expressions having dependencies

Returns:

List of names

Return type:

list[str]

dependents(name: str, direct: bool = True) set[str][source]

Given a name of an expression return its dependencies

Parameters:
  • name (str) – Name of the expression

  • direct (bool, optional) – Whether to return only direct depenencies or also include indirect dependencies, by default True

Returns:

Set of names of all dependencies

Return type:

set[str]

inv_dependency_graph(name: str)[source]

Get the dependency graph where each node reperesents an expression and a directed edge means that there is a dependency.

There will be a directed edge from the root node to another node if the root node depends on the other node.

Parameters:

name (str) – Name of the root node

Returns:

A directed dependency graph

Return type:

nx.DiGraph

property inv_dependent_names: list[str]

Return all the names of the expressions that other expressions depdens on

Returns:

List of names

Return type:

list[str]

inv_dependents(name: str, direct: bool = True) set[str][source]

Given a name of an expression return all expressions that depends on it

Parameters:
  • name (str) – Name of the expression

  • direct (bool, optional) – Whether to return only direct depenencies or also include indirect dependencies, by default True

Returns:

Set of names of all dependencies

Return type:

set[str]

property ode: ODE

Return the ode