DiGraph.completeGraph

static DiGraph.completeGraph(n)

Create a complete directed graph with n nodes.

Parameters:

n (int) – number of nodes

Returns:

directed graph with nodes 0..n-1 and an arc i→j for every i<j (a complete DAG: every pair of nodes is linked by one arc)

Return type:

DiGraph

Example

import pyagrum as gum

g = gum.DiGraph.completeGraph(3)
g.nodes()
# {0, 1, 2}
sorted(g.arcs())
# [(0, 1), (0, 2), (1, 2)]

Used by

DiGraph, DAG

Inheritance diagram of pyagrum.DiGraph, pyagrum.DAG

Overridden in

UndiGraph.completeGraph