-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
Description
Description
We can convert a WTNetwork into a LogicNetwork which, by default, only includes edges if they have a demonstrable effect on the state of target node. The WTNetwork uses the Network.neighbors method to determine which edges exist when converting the network into a networkx.DiGraph. The result is fake edges, particularly self-edges, in the networkx.DiGraph.
Neet Version: 1.0.0
Operating System: ChromeOS 79
To Reproduce
- Convert
neet.boolean.examples.s_pombeinto a logic network viaNetwork.network_graph. - Compare the DiGraphs for the network before and after conversion.
- Compare the incoming neighbors of the nodes as determined by
Network.neighbors.
>>> import neet
>>> import networkx as nx
>>> from neet.boolean.examples import s_pombe
>>> from neet.boolean.conv import wt_to_logic
# Incoming edges identified by Network.neighbors
>>> [s_pombe.neighbors(i, "in") for i in range(s_pombe.size)]
[{0}, {1, 2, 3, 4}, {0, 1, 2, 5, 8}, {0, 1, 3, 5, 8}, {4, 5}, {2, 3, 4, 5, 6, 7}, {8, 1, 6}, {8, 1, 7}, {8, 4}]
>>> [wt_to_logic(s_pombe).neighbors(i, "in") for i in range(s_pombe.size)]
[{0}, {2, 3, 4}, {0, 1, 2, 5, 8}, {0, 1, 3, 5, 8}, {5}, {2, 3, 4, 6, 7}, {8, 1, 6}, {8, 1, 7}, {4}]
# Incoming edges included in DiGraph generated by Network.network_graph
>>> [list(s_pombe.network_graph().predecessors(i)) for i in range(s_pombe.size)]
[[0], [1, 2, 3, 4], [0, 1, 2, 5, 8], [0, 1, 3, 5, 8], [4, 5], [2, 3, 4, 5, 6, 7], [1, 6, 8], [1, 7, 8], [4, 8]]
>>> [list(wt_to_logic(s_pombe).network_graph().predecessors(i)) for i in range(s_pombe.size)]
[[0], [2, 3, 4], [0, 1, 2, 5, 8], [0, 1, 3, 5, 8], [5], [2, 3, 4, 6, 7], [1, 6, 8], [1, 7, 8], [4]]Expected Behavior
The Network.network_graph method should commute with neet.boolean.conv.wt_to_logic.
Actual Behavior
They don't commute.