09.02.2015 Views

Sage Reference Manual: Graph Theory - Mirrors

Sage Reference Manual: Graph Theory - Mirrors

Sage Reference Manual: Graph Theory - Mirrors

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Graph</strong> <strong>Theory</strong>, Release 6.1.1<br />

Giving a Lollipop<strong>Graph</strong>(4,2), that is a complete graph with 4 vertices with a pending edge:<br />

sage: G = graphs.Lollipop<strong>Graph</strong>(4,2)<br />

sage: G.is_cut_vertex(0)<br />

False<br />

sage: G.is_cut_vertex(3)<br />

True<br />

Comparing the weak and strong connectivity of a digraph:<br />

sage: D = digraphs.Circuit(6)<br />

sage: D.is_strongly_connected()<br />

True<br />

sage: D.is_cut_vertex(2)<br />

True<br />

sage: D.is_cut_vertex(2, weak=True)<br />

False<br />

Giving a vertex that is not in the graph:<br />

sage: G = graphs.Complete<strong>Graph</strong>(6)<br />

sage: G.is_cut_vertex(7)<br />

Traceback (most recent call last):<br />

...<br />

ValueError: The input vertex is not in the vertex set.<br />

is_drawn_free_of_edge_crossings()<br />

Returns True is the position dictionary for this graph is set and that position dictionary gives a planar<br />

embedding.<br />

This simply checks all pairs of edges that don’t share a vertex to make sure that they don’t intersect.<br />

Note: This function require that _pos attribute is set. (Returns False otherwise.)<br />

EXAMPLES:<br />

sage: D = graphs.Dodecahedral<strong>Graph</strong>()<br />

sage: D.set_planar_positions()<br />

sage: D.is_drawn_free_of_edge_crossings()<br />

True<br />

is_equitable(partition, quotient_matrix=False)<br />

Checks whether the given partition is equitable with respect to self.<br />

A partition is equitable with respect to a graph if for every pair of cells C1, C2 of the partition, the number<br />

of edges from a vertex of C1 to C2 is the same, over all vertices in C1.<br />

INPUT:<br />

•partition - a list of lists<br />

•quotient_matrix - (default False) if True, and the partition is equitable, returns a matrix over the<br />

integers whose rows and columns represent cells of the partition, and whose i,j entry is the number of<br />

vertices in cell j adjacent to each vertex in cell i (since the partition is equitable, this is well defined)<br />

EXAMPLES:<br />

sage: G = graphs.Petersen<strong>Graph</strong>()<br />

sage: G.is_equitable([[0,4],[1,3,5,9],[2,6,8],[7]])<br />

False<br />

sage: G.is_equitable([[0,4],[1,3,5,9],[2,6,8,7]])<br />

88 Chapter 1. <strong>Graph</strong> objects and methods

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!