@@ -22,6 +22,7 @@ Here is what the module can do:
22
22
:meth:`connected_components_sizes` | Return the sizes of the connected components as a list.
23
23
:meth:`blocks_and_cut_vertices` | Return the blocks and cut vertices of the graph.
24
24
:meth:`blocks_and_cuts_tree` | Return the blocks-and-cuts tree of the graph.
25
+ :meth:`is_biconnected` | Check whether the graph is biconnected.
25
26
:meth:`biconnected_components` | Return the list of biconnected components.
26
27
:meth:`biconnected_components_subgraphs` | Return a list of biconnected components as graph objects.
27
28
:meth:`number_of_biconnected_components` | Return the number of biconnected components.
@@ -92,7 +93,7 @@ def is_connected(G, forbidden_vertices=None):
92
93
93
94
.. SEEALSO::
94
95
95
- - :meth:`~Graph .is_biconnected`
96
+ - :meth:`~sage.graphs.generic_graph.GenericGraph .is_biconnected`
96
97
97
98
EXAMPLES::
98
99
@@ -507,7 +508,7 @@ def blocks_and_cut_vertices(G, algorithm='Tarjan_Boost', sort=False, key=None):
507
508
508
509
- :meth:`blocks_and_cuts_tree`
509
510
- :func:`sage.graphs.base.boost_graph.blocks_and_cut_vertices`
510
- - :meth:`~Graph .is_biconnected`
511
+ - :meth:`~sage.graphs.generic_graph.GenericGraph .is_biconnected`
511
512
- :meth:`~Graph.bridges`
512
513
513
514
EXAMPLES:
@@ -718,7 +719,7 @@ def blocks_and_cuts_tree(G):
718
719
.. SEEALSO::
719
720
720
721
- :meth:`~sage.graphs.generic_graph.GenericGraph.blocks_and_cut_vertices`
721
- - :meth:`~Graph .is_biconnected`
722
+ - :meth:`~sage.graphs.generic_graph.GenericGraph .is_biconnected`
722
723
723
724
EXAMPLES::
724
725
@@ -780,6 +781,46 @@ def blocks_and_cuts_tree(G):
780
781
return g
781
782
782
783
784
+ def is_biconnected (G ):
785
+ r """
786
+ Check whether the graph is biconnected.
787
+
788
+ A biconnected graph is a connected graph on two or more vertices that is not
789
+ broken into disconnected pieces by deleting any single vertex.
790
+
791
+ .. SEEALSO::
792
+
793
+ - :meth:`~sage. graphs. generic_graph. GenericGraph. is_connected`
794
+ - :meth:`~sage. graphs. generic_graph. GenericGraph. blocks_and_cut_vertices`
795
+ - :meth:`~sage. graphs. generic_graph. GenericGraph. blocks_and_cuts_tree`
796
+ - :wikipedia:`Biconnected_graph`
797
+
798
+ EXAMPLES::
799
+
800
+ sage: G = graphs. PetersenGraph( )
801
+ sage: G. is_biconnected( )
802
+ True
803
+ sage: G. add_path( [0,'a','b' ])
804
+ sage: G. is_biconnected( )
805
+ False
806
+ sage: G. add_edge( 'b', 1)
807
+ sage: G. is_biconnected( )
808
+ True
809
+
810
+ TESTS::
811
+
812
+ sage: Graph( ) . is_biconnected( )
813
+ False
814
+ sage: Graph( 1) . is_biconnected( )
815
+ False
816
+ sage: graphs. CompleteGraph( 2) . is_biconnected( )
817
+ True
818
+ """
819
+ if G.order() < 2 or not G.is_connected():
820
+ return False
821
+ return not G.blocks_and_cut_vertices()[1 ]
822
+
823
+
783
824
def biconnected_components (G ):
784
825
r """
785
826
Return the list of biconnected components.
@@ -867,7 +908,7 @@ def number_of_biconnected_components(G):
867
908
.. SEEALSO::
868
909
869
910
- :meth:`~sage. graphs. generic_graph. GenericGraph. blocks_and_cut_vertices`
870
- - :meth:`~Graph . is_biconnected`
911
+ - :meth:`~sage . graphs . generic_graph . GenericGraph . is_biconnected`
871
912
872
913
EXAMPLES:
873
914
@@ -3466,7 +3507,7 @@ cdef class TriconnectivitySPQR:
3466
3507
.. SEEALSO::
3467
3508
3468
3509
- :meth:`sage. graphs. connectivity. spqr_tree`
3469
- - :meth:`~Graph . is_biconnected`
3510
+ - :meth:`~sage . graphs . generic_graph . GenericGraph . is_biconnected`
3470
3511
- :wikipedia:`SPQR_tree`
3471
3512
3472
3513
EXAMPLES:
@@ -4892,7 +4933,7 @@ def is_triconnected(G):
4892
4933
.. SEEALSO::
4893
4934
4894
4935
- :meth:`~sage. graphs. generic_graph. GenericGraph. is_connected`
4895
- - :meth:`~Graph . is_biconnected`
4936
+ - :meth:`~sage . graphs . generic_graph . GenericGraph . is_biconnected`
4896
4937
- :meth:`~sage. graphs. connectivity. spqr_tree`
4897
4938
- :wikipedia:`SPQR_tree`
4898
4939
0 commit comments