sgtl.graph.complete_graph

sgtl.graph.complete_graph(number_of_vertices: int) sgtl.graph.Graph

Construct the complete unweighted graph on \(n\) vertices.

Parameters

number_of_vertices – The number of vertices in the graph.

Returns

The complete graph on \(n\) vertices, as a Graph object.

Raises

ValueError – if the number of vertices is not a positive integer.

Example
>>> import sgtl.graph
>>> graph = sgtl.graph.complete_graph(4)
>>> graph.adjacency_matrix().toarray()
array([[0., 1., 1., 1.],
       [1., 0., 1., 1.],
       [1., 1., 0., 1.],
       [1., 1., 1., 0.]])