penaltymodel.as_graph#
- as_graph(graph_like: int | Sequence[int] | 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_likeis a NetworkX graph then it is returned.