specless.io
This module contains functions to save and draw graphs and strategies.
Examples
Draw a graph: >>> import networkx as nx >>> from specless.io import draw_graph >>> G = nx.DiGraph() >>> G.add_node(“A”) >>> G.add_node(“B”) >>> G.add_edge(“A”, “B”) >>> draw_graph(G, “graph.png”) <IPython.core.display.Image object>
Draw a strategy: >>> from specless.strategy import PlanStrategy >>> from specless.io import save_strategy >>> plan = [“A”, “B”] >>> strategy = PlanStrategy(plan) >>> save_strategy(strategy, “strategy.png”)
Save a graph: >>> from specless.io import save_graph >>> save_graph(G, “graph.png”)
Save a strategy: >>> save_strategy(strategy, “strategy.png”)
Notes
This module is a work in progress.
Functions
Add labels to the nodes and edges of a graph. |
|
Draw a class that is derived from a networkx DiGraph and save it to a file. |
|
Generate a label for an edge based on its data. |
|
Generate a label for a node based on its data. |
|
Save a class that is derived from a networkx MultiDiGraph to a file. |
|
Save a strategy class to a file. |