| 2434 | def DyckGraph(self): |
| 2435 | """ |
| 2436 | Returns the Dyck graph. |
| 2437 | |
| 2438 | For more information, see the `MathWorld article on the Dyck graph |
| 2439 | <http://mathworld.wolfram.com/DyckGraph.html>`_ or the `Wikipedia |
| 2440 | article on the Dyck graph <http://en.wikipedia.org/wiki/Dyck_graph>`_. |
| 2441 | |
| 2442 | EXAMPLES: |
| 2443 | |
| 2444 | The Dyck graph was defined by Walther von Dyck in 1881. It has `32` |
| 2445 | vertices and `48` edges, and is a cubic graph (regular of degree `3`):: |
| 2446 | |
| 2447 | sage: G = graphs.DyckGraph(); G |
| 2448 | Dyck graph: Graph on 32 vertices |
| 2449 | sage: G.order() |
| 2450 | 32 |
| 2451 | sage: G.size() |
| 2452 | 48 |
| 2453 | sage: G.is_regular() |
| 2454 | True |
| 2455 | sage: G.is_regular(3) |
| 2456 | True |
| 2457 | |
| 2458 | It is non-planar and Hamiltonian, as well as bipartite (making it a |
| 2459 | bicubic graph):: |
| 2460 | |
| 2461 | sage: G.is_planar() |
| 2462 | False |
| 2463 | sage: G.is_hamiltonian() |
| 2464 | True |
| 2465 | sage: G.is_bipartite() |
| 2466 | True |
| 2467 | |
| 2468 | It has radius `5`, diameter `5`, and girth `6`:: |
| 2469 | |
| 2470 | sage: G.radius() |
| 2471 | 5 |
| 2472 | sage: G.diameter() |
| 2473 | 5 |
| 2474 | sage: G.girth() |
| 2475 | 6 |
| 2476 | |
| 2477 | Its chromatic number is `2` and its automorphism group is of order |
| 2478 | `192`:: |
| 2479 | |
| 2480 | sage: G.chromatic_number() |
| 2481 | 2 |
| 2482 | sage: G.automorphism_group().cardinality() |
| 2483 | 192 |
| 2484 | |
| 2485 | It is a non-integral graph as it has irrational eigenvalues:: |
| 2486 | |
| 2487 | sage: G.characteristic_polynomial().factor() |
| 2488 | (x - 3) * (x + 3) * (x - 1)^9 * (x + 1)^9 * (x^2 - 5)^6 |
| 2489 | |
| 2490 | It is a toroidal graph, and its embedding on a torus is dual to an |
| 2491 | embedding of the Shrikhande graph (:meth:`ShrikhandeGraph |
| 2492 | <GraphGenerators.ShrikhandeGraph>`). |
| 2493 | """ |
| 2494 | pos_dict = {} |
| 2495 | for i in range(8): |
| 2496 | pos_dict[i] = [float(cos((2*i) * pi/8)), |
| 2497 | float(sin((2*i) * pi/8))] |
| 2498 | pos_dict[8 + i] = [0.75 * pos_dict[i][0], |
| 2499 | 0.75 * pos_dict[i][1]] |
| 2500 | pos_dict[16 + i] = [0.50 * pos_dict[i][0], |
| 2501 | 0.50 * pos_dict[i][1]] |
| 2502 | pos_dict[24 + i] = [0.25 * pos_dict[i][0], |
| 2503 | 0.25 * pos_dict[i][1]] |
| 2504 | |
| 2505 | edge_dict = { |
| 2506 | 0O00: [0O07, 0O01, 0O10], 0O10: [0O00, 0O27, 0O21], |
| 2507 | 0O01: [0O00, 0O02, 0O11], 0O11: [0O01, 0O20, 0O22], |
| 2508 | 0O02: [0O01, 0O03, 0O12], 0O12: [0O02, 0O21, 0O23], |
| 2509 | 0O03: [0O02, 0O04, 0O13], 0O13: [0O03, 0O22, 0O24], |
| 2510 | 0O04: [0O03, 0O05, 0O14], 0O14: [0O04, 0O23, 0O25], |
| 2511 | 0O05: [0O04, 0O06, 0O15], 0O15: [0O05, 0O24, 0O26], |
| 2512 | 0O06: [0O05, 0O07, 0O16], 0O16: [0O06, 0O25, 0O27], |
| 2513 | 0O07: [0O06, 0O00, 0O17], 0O17: [0O07, 0O26, 0O20], |
| 2514 | |
| 2515 | 0O20: [0O17, 0O11, 0O30], 0O30: [0O20, 0O35, 0O33], |
| 2516 | 0O21: [0O10, 0O12, 0O31], 0O31: [0O21, 0O36, 0O34], |
| 2517 | 0O22: [0O11, 0O13, 0O32], 0O32: [0O22, 0O37, 0O35], |
| 2518 | 0O23: [0O12, 0O14, 0O33], 0O33: [0O23, 0O30, 0O36], |
| 2519 | 0O24: [0O13, 0O15, 0O34], 0O34: [0O24, 0O31, 0O37], |
| 2520 | 0O25: [0O14, 0O16, 0O35], 0O35: [0O25, 0O32, 0O30], |
| 2521 | 0O26: [0O15, 0O17, 0O36], 0O36: [0O26, 0O33, 0O31], |
| 2522 | 0O27: [0O16, 0O10, 0O37], 0O37: [0O27, 0O34, 0O32], |
| 2523 | } |
| 2524 | |
| 2525 | return graph.Graph(edge_dict, pos=pos_dict, name="Dyck graph") |
| 2526 | |