-
Notifications
You must be signed in to change notification settings - Fork 76
Export networkx graph
Patricia Wollstadt edited this page Jul 18, 2018
·
1 revision
IDTxl allows to export inferred networks to the networkx
Python
package. The networkx
package provides plotting
functionalities, graph algorithms, and further export functions. The inferred
network is exported as a weighted, directed graph object DiGraph()
.
import pickle
from idtxl import idtxl_io as io
results = pickle.load(open('test/data/mute_results_0.p', 'rb'))
Example: export inferred network, using the lag of the past variable with maximum information transfer into the target to weight edges
weights = 'max_te_lag'
adj_matrix = results.get_adjacency_matrix(weights=weights, fdr=False)
io.export_networkx_graph(adjacency_matrix=adj_matrix, weights=weights)
Example: export graph of inferred past variables for a single target
io.export_networkx_source_graph(
results=results, target=1, sign_sources=True, fdr=False)
By setting sign_sources
to True
only significant sources are included, otherwise
all sources in the cadidate set are plotted.