Build and JSON string from a communication graph. The JSON string can be used to construct a `NetworkX `_ graph. This is helpful for cases where a simulation is executed and the graph data is written to file as a JSON string for later analysis. Args:
(graph: AdjacencyList)
| 201 | |
| 202 | |
| 203 | def comm_to_json(graph: AdjacencyList) -> str: |
| 204 | """Build and JSON string from a communication graph. |
| 205 | |
| 206 | The JSON string can be used to construct a `NetworkX |
| 207 | <https://networkx.org/>`_ graph. This is helpful for cases where a |
| 208 | simulation is executed and the graph data is written to file as a |
| 209 | JSON string for later analysis. |
| 210 | |
| 211 | Args: |
| 212 | graph: The communication graph to convert. Normally created by |
| 213 | calling :meth:`comm_graph`. |
| 214 | |
| 215 | Returns: |
| 216 | A JSON string representing the communication graph. |
| 217 | """ |
| 218 | return _cpp.graph.comm_to_json(graph._cpp_object) |