sgtl.graph.star_graph¶
- sgtl.graph.star_graph(number_of_vertices: int) sgtl.graph.Graph¶
Construct the unweighted star graph on \(n\) vertices.
- Parameters
number_of_vertices – The number of vertices in the graph
- Returns
The star 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.star_graph(4) >>> graph.adjacency_matrix().toarray() array([[0., 1., 1., 1.], [1., 0., 0., 0.], [1., 0., 0., 0.], [1., 0., 0., 0.]])