Tools: tl
Lattice representation
mbnet.tl.lattice(df)
Constructs a directed lattice graph from a DataFrame of binary vectors.
Parameters:
-
df(DataFrame) –A DataFrame where each row represents a binary vector and each column represents a dimension. The index of the DataFrame will be used as node names in the resulting graph.
Returns:
-
DiGraph–A directed graph representing the lattice structure of the input vectors. - Nodes: Named according to the DataFrame index. - Node attribute "level": Sum of 1s in each binary vector. - Directed edges: (u -> v) whenever v is obtained from u by flipping exactly one 0 to 1 (Partially ordered).
Notes
- Edges are directed from lower to higher vectors in the partial order.
- The function identifies candidate edges by computing pairwise Hamming distances and keeps only those exactly 1 unit apart.
- Edge orientation is determined by element-wise comparison of the binary vectors.
Source code in src/mbnet/tl.py
mbnet.tl.lattice_B(n)
Constructs the lattice as a directed graph for n-dimensional Boolean vectors.
Parameters:
-
n(int) –Dimension of the Boolean vector. Must be a non-negative integer.
Returns:
-
DiGraph–A directed graph representing the n-dimensional Boolean lattice. - Nodes: Boolean vectors as strings. - Node attribute "level": Number of 1s of the node. - Directed edges: (u -> v) whenever v is obtained from u by flipping exactly one 0 to 1 (Partially ordered).
Notes
- The graph contains 2**n nodes. Time and memory costs grow exponentially with n.
- The function uses pairwise Hamming distances to identify candidate edges and then orients them from lower to higher bitwise vectors.
Source code in src/mbnet/tl.py
mbnet.tl.lattice_MBF(n)
Constructs the lattice as a directed graph for monotone Boolean functions with n inputs.
Parameters:
-
n(int) –The number of inputs for the monotone Boolean functions (MBF). Must be a non-negative integer.
Returns:
-
DiGraph–A directed graph representing the n-input MBF lattice. - Nodes: MBF names. - Node attribute "level": Number of 1 outputs of the function. - Directed edges: (u -> v) if the truth set of u is a subset of the truth set of v.
Source code in src/mbnet/tl.py
Enumeration of steady states
mbnet.tl.n_mbm(adjmat)
Computes the number of monotone Boolean functions (MBFs) for each Boolean state for a given network topology.
Parameters:
-
adjmat–Adjacency matrix of the network topology.
Returns:
-
DataFrame–DataFrame containing the number of MBF for each target node and the total product across all nodes. The index gives the Boolean state in same order as the columns.
Source code in src/mbnet/tl.py
mbnet.tl.UL_mbm(adjmat)
Lattice representation of monotone Boolean functions (MBFs) for each Boolean state for a given network topology.
Parameters:
-
adjmat–Adjacency matrix of the network topology.
Returns:
-
DataFrame–DataFrame containing the lattice representation of MBF for each target node. The index gives the Boolean state in same order as the columns.
Source code in src/mbnet/tl.py
Parameter Sets
mbnet.tl.param_set(adjmat, explode=True)
Gives the set of parameter sets (MBF combinations) for each Boolean state for a given network topology.
Parameters:
-
adjmat–Adjacency matrix of the network topology.
-
explode–If True, explodes the resulting DataFrame to individual rows for each MBF combination. If False, each cell contains a set of valid MBF combinations.
Returns:
-
DataFrame–A DataFrame with columns corresponding to target nodes. Each row contains either a set of valid MBF combinations (when explode=False) or individual MBF combinations (when explode=True). The Boolean state is given in a 'state' column (when explode=True), otherwise as the index.
Notes
- Uses mn.utils.L_set() for targets with output value 0
- Uses mn.utils.U_set() for targets with output value 1
Source code in src/mbnet/tl.py
mbnet.tl.multistable(adjmat, states, explode=True)
Gives parameter combinations that support multistability between the given states for a given topology.
Parameters:
-
adjmat–Adjacency matrix of the network topology.
-
states–DataFrame containing the states to consider for multistability.
-
explode–If True, explodes the parameter sets into separate rows for each parameter combination.
Returns:
-
DataFrame–A DataFrame where each column corresponds to a target node and each cell contains a set of MBF combinations that support multistability between the given states. If explode is True, the sets are expanded into MBF combinations.
Notes
This function identifies multistable functions by taking the intersection of corresponding L_set and U_set's.