Reputation: 99
As the title says, I'm using networkX to represent some cell networks in Python. The network is at the bottom of this post since it's a large image.
The reason I'm doing this is because some of theres nodes are considered "input" and some will be considered "output", and I need to be able to calculate the number of signal paths (the number of paths from input to output) that each node participates in. however, I don't think networkX offers edge directionality, which I believe is needed to calculate signal paths for nodes.
Does anyone know if its possible to add direction to edges in networkX, or if its possible to calculate signal paths without directionality?
Here's the code I wrote up until I realized I needed directional edges:
import networkx as nx
import matplotlib.pyplot as plt
G=nx.Graph()
molecules = ["CD40L", "CD40", "NF-kB", "XBP1", "Pax5", "Bach2", "Irf4", "IL-4",
"IL-4R", "STAT6", "AID", "Blimp1", "Bcl6", "ERK", "BCR", "STAT3", "Ag", "STAT5",
"IL-21R", "IL-21", "IL-2", "IL-2R"]
Bcl6_edges = [("Bcl6", "Bcl6"), ("Bcl6", "Blimp1"), ("Bcl6", "Irf4")]
STAT5_edges = [("STAT5", "Bcl6")]
edges = Bcl6_edges + STAT5_edges
G.add_nodes_from(molecules)
G.add_edges_from(edges)
Upvotes: 1
Views: 435