Skip to content

WTNetwork.network_graph includes fake self-edges #193

@dglmoore

Description

@dglmoore

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

  1. Convert neet.boolean.examples.s_pombe into a logic network via Network.network_graph.
  2. Compare the DiGraphs for the network before and after conversion.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions