Graphs API Reference
This page provides API reference documentation for the Graphs module, which contains functions for network graph analysis and visualization.
Graph Generation Functions
bmtool.graphs.generate_graph(config, source, target)
Generate a NetworkX graph from BMTK network configuration.
Parameters:
config : str Path to a BMTK simulation config file. source : str Network name for source nodes. target : str Network name for target nodes.
Returns:
nx.DiGraph A directed graph representing the network with nodes containing position and population information.
Source code in bmtool/graphs.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
Graph Export Functions
bmtool.graphs.export_node_connections_to_csv(Graph, filename)
Generate a CSV file with node type and all incoming connections that node has.
Parameters:
Graph : nx.DiGraph A directed graph object from NetworkX. filename : str Path and filename for the output CSV file (must end in .csv).
Returns:
None The function saves the results to the specified CSV file.
Notes:
The resulting CSV file will have the node label as the first column, followed by columns for each type of incoming connection.
Source code in bmtool/graphs.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|