is_threshold_graph#
- graph_tool.structure.is_threshold_graph(g)[git][source]#
Return whether the graph is a threshold graph.
- Parameters:
- g
Graph Graph to be used. Edge directions, self-loops, and parallel edges are ignored.
- g
- Returns:
- is_threshold
bool Trueif the graph is a threshold graph.
- is_threshold
See also
find_threshold_graphThreshold subgraph of a graph
Notes
A threshold graph [chvatal-aggregation-1977] can be built from the empty graph by adding repeatedly an isolated vertex or a vertex connected to all previous ones. This holds if and only if its degree sequence is a threshold sequence, i.e. one that can be reduced to the empty sequence by removing repeatedly a zero entry or an entry equal to the number of the remaining entries minus one, which in the latter case are decreased by one. The time is \(O(V\log V + E)\).
References
[chvatal-aggregation-1977]Václav Chvátal and Peter L. Hammer, “Aggregation of inequalities in integer programming”, Annals of Discrete Mathematics 1, 145-162 (1977), DOI: 10.1016/S0167-5060(08)70731-3 [sci-hub, @tor]
Examples
>>> print(gt.is_threshold_graph(gt.complete_graph(5)), ... gt.is_threshold_graph(gt.circular_graph(5))) True False