dimod.decorators.graph_argument

graph_argument(*arg_names, **options)[source]

Decorator to coerce given graph arguments into a consistent form.

The wrapped function accepts either an integer n, interpreted as a complete graph of size n, a nodes/edges pair, a sequence of edges, or a NetworkX graph. The argument is converted into a nodes/edges 2-tuple.

Parameters:
  • *arg_names (optional, default='G') – Names of the arguments for input graphs.
  • allow_None (bool, optional, default=False) – If True, None can be passed through as an input graph.