penaltymodel.as_graph¶
- as_graph(graph_like: Union[int, Sequence[int], networkx.classes.graph.Graph]) networkx.classes.graph.Graph [source]¶
Create a NetworkX graph from a graph-like.
- Parameters
graph_like – A NetworkX
Graph
, a list of nodes or a number. If it is a list of nodes, then a complete graph with those nodes is returned. If it is a number, then the list of nodes is treated asrange(n)
.- Returns
A NetworkX graph. If
graph_like
is a NetworkX graph then it is returned.