hynet.visual package

Submodules

hynet.visual.graph module

Visualization of network graphs.

hynet uses NetworkX to export graph data. NetworkX can export to various popular formats, including the GraphViz DOT format and JSON.

hynet.visual.graph.create_networkx_graph(data)[source]

Return a NetworkX graph object for the provided network graph.

Buses and injectors are inserted as nodes. Branches and converters are inserted as edges between the buses, while injectors are connected via additional edges to their respective terminal bus. The scenario data and, if provided, the OPF result data of the individual entities is added as attributes to the respective graph elements. The returned NetworkX graph can be exported into various formats, please refer to the documentation of NetworkX.

Parameters:data (Scenario or SystemModel or SystemResult) – Scenario object, SystemModel object, or SystemResult object that contains the network graph information.
Returns:graph – NetworkX graph representation of the grid’s network graph.
Return type:nx.Graph
hynet.visual.graph.export_networkx_graph_to_json(graph, output_file)[source]

Exports a NetworkX graph object to a JSON file.

The specified network graph is exported to the JSON format, which is supported by D3 [1].

Remark: As a simple tool to visualize the graph, this subpackage includes the web page show_graph.html in the subdirectory rendering. To use it, store the graph object to the file network_graph.json and open the aforementioned HTML file.

Parameters:
  • graph (nx.Graph) – The graph that shall be exported to the JSON format.
  • output_file (str) – The file name to which the JSON data shall be exported.

References

[1]https://github.com/d3/d3

Module contents

Collection of visualization utilities for hynet.