2422 | | For more information, see this `Wikipedia article on the Balaban |
2423 | | 11-cage <http://en.wikipedia.org/wiki/Balaban_11-cage>`_. |
2424 | | """ |
2425 | | pos_dict = {} |
2426 | | for j in range(8): |
2427 | | for i in range(8): |
2428 | | pos_dict[str(j) + str(i)]= [ |
2429 | | 0.8 * float(cos(2*((8*j + i)*pi/64 + pi/128))), |
2430 | | 0.8 * float(sin(2*((8*j + i)*pi/64 + pi/128))) |
2431 | | ] |
2432 | | for i in range(4): |
2433 | | pos_dict['1' + str(j) + str(i)] = [ |
2434 | | 1.1 * float(cos(2*((4*j + i)*pi/32 + pi/64))), |
2435 | | 1.1 * float(sin(2*((4*j + i)*pi/32 + pi/64))) |
2436 | | ] |
2437 | | for i in range(2): |
2438 | | pos_dict['1' + str(j) + str(i + 4)] = [ |
2439 | | 1.4 * float(cos(2*((2*j + i)*pi/16 + pi/32))), |
2440 | | 1.4 * float(sin(2*((2*j + i)*pi/16 + pi/32))) |
2441 | | ] |
2442 | | |
2443 | | edge_dict = { |
2444 | | "00": ["11"], "01": ["10"], "02": ["53"], "03": ["52"], |
2445 | | "11": ["20"], "10": ["21"], "53": ["22"], "52": ["23"], |
2446 | | "20": ["31"], "21": ["30"], "22": ["33"], "23": ["32"], |
2447 | | "31": ["40"], "30": ["41"], "33": ["43"], "32": ["42"], |
2448 | | "40": ["50"], "41": ["51"], "43": ["12"], "42": ["13"], |
2449 | | "50": ["61"], "51": ["60"], "12": ["63"], "13": ["62"], |
2450 | | "61": ["70"], "60": ["71"], "63": ["72"], "62": ["73"], |
2451 | | "70": ["01"], "71": ["00"], "72": ["03"], "73": ["02"], |
2452 | | |
2453 | | "04": ["35"], "05": ["34"], "06": ["37"], "07": ["36"], |
2454 | | "35": ["64"], "34": ["65"], "37": ["66"], "36": ["67"], |
2455 | | "64": ["55"], "65": ["54"], "66": ["17"], "67": ["16"], |
2456 | | "55": ["45"], "54": ["44"], "17": ["46"], "16": ["47"], |
2457 | | "45": ["74"], "44": ["75"], "46": ["76"], "47": ["77"], |
2458 | | "74": ["25"], "75": ["24"], "76": ["27"], "77": ["26"], |
2459 | | "25": ["14"], "24": ["15"], "27": ["56"], "26": ["57"], |
2460 | | "14": ["05"], "15": ["04"], "56": ["07"], "57": ["06"], |
2461 | | |
2462 | | |
2463 | | |
2464 | | "100": ["03", "04"], "110": ["10", "12"], |
2465 | | "101": ["01", "06"], "111": ["11", "13"], |
2466 | | "102": ["00", "07"], "112": ["14", "16"], |
2467 | | "103": ["02", "05"], "113": ["15", "17"], |
2468 | | |
2469 | | "120": ["22", "24"], "130": ["33", "36"], |
2470 | | "121": ["20", "26"], "131": ["32", "37"], |
2471 | | "122": ["21", "27"], "132": ["31", "34"], |
2472 | | "123": ["23", "25"], "133": ["30", "35"], |
2473 | | |
2474 | | "140": ["43", "45"], "150": ["50", "52"], |
2475 | | "141": ["40", "46"], "151": ["51", "53"], |
2476 | | "142": ["41", "47"], "152": ["54", "56"], |
2477 | | "143": ["42", "44"], "153": ["55", "57"], |
2478 | | |
2479 | | "160": ["60", "66"], "170": ["73", "76"], |
2480 | | "161": ["63", "65"], "171": ["72", "77"], |
2481 | | "162": ["62", "64"], "172": ["71", "74"], |
2482 | | "163": ["61", "67"], "173": ["70", "75"], |
2483 | | |
2484 | | |
2485 | | |
2486 | | "104": ["100", "102", "105"], "114": ["110", "111", "115"], |
2487 | | "105": ["101", "103", "104"], "115": ["112", "113", "114"], |
2488 | | |
2489 | | "124": ["120", "121", "125"], "134": ["130", "131", "135"], |
2490 | | "125": ["122", "123", "124"], "135": ["132", "133", "134"], |
2491 | | |
2492 | | "144": ["140", "141", "145"], "154": ["150", "151", "155"], |
2493 | | "145": ["142", "143", "144"], "155": ["152", "153", "154"], |
2494 | | |
2495 | | "164": ["160", "161", "165"], "174": ["170", "171", "175"], |
2496 | | "165": ["162", "163", "164"], "175": ["172", "173", "174"] |
2497 | | } |
2498 | | |
2499 | | return graph.Graph(edge_dict, pos=pos_dict, name="Balaban 11-cage") |
| 2422 | For more information, see this :wikipedia:`Wikipedia article on |
| 2423 | the Balaban 11-cage <Balaban_11-cage>`. |
| 2424 | |
| 2425 | INPUT: |
| 2426 | |
| 2427 | - ``embedding`` -- three embeddings are available, and can be |
| 2428 | selected by setting ``embedding`` to be 1, 2, or 3. |
| 2429 | |
| 2430 | - The first embedding is the one appearing on page 9 of the |
| 2431 | Fifth Annual Graph Drawing Contest report [FAGDC]_. |
| 2432 | |
| 2433 | - The second embedding has been produced just for Sage and is |
| 2434 | meant to emphasize the automorphism group's 6 orbits. |
| 2435 | |
| 2436 | - The last embedding is the default one produced by the |
| 2437 | :meth:`LCFGraph` constructor. |
| 2438 | |
| 2439 | .. NOTE:: |
| 2440 | |
| 2441 | The vertex labeling changes according to the value of |
| 2442 | ``embedding=1``. |
| 2443 | |
| 2444 | EXAMPLES: |
| 2445 | |
| 2446 | Basic properties:: |
| 2447 | |
| 2448 | sage: g = graphs.Balaban11Cage() |
| 2449 | sage: g.order() |
| 2450 | 112 |
| 2451 | sage: g.size() |
| 2452 | 168 |
| 2453 | sage: g.girth() |
| 2454 | 11 |
| 2455 | sage: g.diameter() |
| 2456 | 8 |
| 2457 | sage: g.automorphism_group().cardinality() |
| 2458 | 64 |
| 2459 | |
| 2460 | Our many embeddings:: |
| 2461 | |
| 2462 | sage: graphs.Balaban11Cage(embedding=1).show(figsize=[10,10]) |
| 2463 | sage: graphs.Balaban11Cage(embedding=2).show(figsize=[10,10]) |
| 2464 | sage: graphs.Balaban11Cage(embedding=3).show(figsize=[10,10]) |
| 2465 | |
| 2466 | REFERENCES: |
| 2467 | |
| 2468 | .. [FAGDC] Fifth Annual Graph Drawing Contest |
| 2469 | P. Eaded, J. Marks, P.Mutzel, S. North |
| 2470 | http://www.merl.com/papers/docs/TR98-16.pdf |
| 2471 | """ |
| 2472 | if embedding == 1: |
| 2473 | pos_dict = {} |
| 2474 | for j in range(8): |
| 2475 | for i in range(8): |
| 2476 | pos_dict[str(j) + str(i)]= [ |
| 2477 | 0.8 * float(cos(2*((8*j + i)*pi/64 + pi/128))), |
| 2478 | 0.8 * float(sin(2*((8*j + i)*pi/64 + pi/128))) |
| 2479 | ] |
| 2480 | for i in range(4): |
| 2481 | pos_dict['1' + str(j) + str(i)] = [ |
| 2482 | 1.1 * float(cos(2*((4*j + i)*pi/32 + pi/64))), |
| 2483 | 1.1 * float(sin(2*((4*j + i)*pi/32 + pi/64))) |
| 2484 | ] |
| 2485 | for i in range(2): |
| 2486 | pos_dict['1' + str(j) + str(i + 4)] = [ |
| 2487 | 1.4 * float(cos(2*((2*j + i)*pi/16 + pi/32))), |
| 2488 | 1.4 * float(sin(2*((2*j + i)*pi/16 + pi/32))) |
| 2489 | ] |
| 2490 | |
| 2491 | edge_dict = { |
| 2492 | "00": ["11"], "01": ["10"], "02": ["53"], "03": ["52"], |
| 2493 | "11": ["20"], "10": ["21"], "53": ["22"], "52": ["23"], |
| 2494 | "20": ["31"], "21": ["30"], "22": ["33"], "23": ["32"], |
| 2495 | "31": ["40"], "30": ["41"], "33": ["43"], "32": ["42"], |
| 2496 | "40": ["50"], "41": ["51"], "43": ["12"], "42": ["13"], |
| 2497 | "50": ["61"], "51": ["60"], "12": ["63"], "13": ["62"], |
| 2498 | "61": ["70"], "60": ["71"], "63": ["72"], "62": ["73"], |
| 2499 | "70": ["01"], "71": ["00"], "72": ["03"], "73": ["02"], |
| 2500 | |
| 2501 | "04": ["35"], "05": ["34"], "06": ["37"], "07": ["36"], |
| 2502 | "35": ["64"], "34": ["65"], "37": ["66"], "36": ["67"], |
| 2503 | "64": ["55"], "65": ["54"], "66": ["17"], "67": ["16"], |
| 2504 | "55": ["45"], "54": ["44"], "17": ["46"], "16": ["47"], |
| 2505 | "45": ["74"], "44": ["75"], "46": ["76"], "47": ["77"], |
| 2506 | "74": ["25"], "75": ["24"], "76": ["27"], "77": ["26"], |
| 2507 | "25": ["14"], "24": ["15"], "27": ["56"], "26": ["57"], |
| 2508 | "14": ["05"], "15": ["04"], "56": ["07"], "57": ["06"], |
| 2509 | |
| 2510 | "100": ["03", "04"], "110": ["10", "12"], |
| 2511 | "101": ["01", "06"], "111": ["11", "13"], |
| 2512 | "102": ["00", "07"], "112": ["14", "16"], |
| 2513 | "103": ["02", "05"], "113": ["15", "17"], |
| 2514 | |
| 2515 | "120": ["22", "24"], "130": ["33", "36"], |
| 2516 | "121": ["20", "26"], "131": ["32", "37"], |
| 2517 | "122": ["21", "27"], "132": ["31", "34"], |
| 2518 | "123": ["23", "25"], "133": ["30", "35"], |
| 2519 | |
| 2520 | "140": ["43", "45"], "150": ["50", "52"], |
| 2521 | "141": ["40", "46"], "151": ["51", "53"], |
| 2522 | "142": ["41", "47"], "152": ["54", "56"], |
| 2523 | "143": ["42", "44"], "153": ["55", "57"], |
| 2524 | |
| 2525 | "160": ["60", "66"], "170": ["73", "76"], |
| 2526 | "161": ["63", "65"], "171": ["72", "77"], |
| 2527 | "162": ["62", "64"], "172": ["71", "74"], |
| 2528 | "163": ["61", "67"], "173": ["70", "75"], |
| 2529 | |
| 2530 | "104": ["100", "102", "105"], "114": ["110", "111", "115"], |
| 2531 | "105": ["101", "103", "104"], "115": ["112", "113", "114"], |
| 2532 | |
| 2533 | "124": ["120", "121", "125"], "134": ["130", "131", "135"], |
| 2534 | "125": ["122", "123", "124"], "135": ["132", "133", "134"], |
| 2535 | |
| 2536 | "144": ["140", "141", "145"], "154": ["150", "151", "155"], |
| 2537 | "145": ["142", "143", "144"], "155": ["152", "153", "154"], |
| 2538 | |
| 2539 | "164": ["160", "161", "165"], "174": ["170", "171", "175"], |
| 2540 | "165": ["162", "163", "164"], "175": ["172", "173", "174"] |
| 2541 | } |
| 2542 | |
| 2543 | return graph.Graph(edge_dict, pos=pos_dict, name="Balaban 11-cage") |
| 2544 | |
| 2545 | elif embedding == 2 or embedding == 3: |
| 2546 | L = [44, 26, -47, -15, 35, -39, 11, -27, 38, -37, 43, 14, 28, 51, |
| 2547 | -29, -16, 41, -11, -26, 15, 22, -51, -35, 36, 52, -14, -33, |
| 2548 | -26, -46, 52, 26, 16, 43, 33, -15, 17, -53, 23, -42, -35, -28, |
| 2549 | 30, -22, 45, -44, 16, -38, -16, 50, -55, 20, 28, -17, -43, |
| 2550 | 47, 34, -26, -41, 11, -36, -23, -16, 41, 17, -51, 26, -33, |
| 2551 | 47, 17, -11, -20, -30, 21, 29, 36, -43, -52, 10, 39, -28, -17, |
| 2552 | -52, 51, 26, 37, -17, 10, -10, -45, -34, 17, -26, 27, -21, |
| 2553 | 46, 53, -10, 29, -50, 35, 15, -47, -29, -41, 26, 33, 55, -17, |
| 2554 | 42, -26, -36, 16] |
| 2555 | |
| 2556 | g = graphs.LCFGraph(112, L, 1) |
| 2557 | g.name("Balaban 11-cage") |
| 2558 | |
| 2559 | if embedding == 3: |
| 2560 | return g |
| 2561 | |
| 2562 | v1 = [34, 2, 54, 43, 66, 20, 89, 100, 72, 76, 6, 58, 16, 78, 74, |
| 2563 | 70, 36, 94, 27, 25, 10, 8, 45, 60, 14, 64, 80, 82, 109, 107, |
| 2564 | 49, 98] |
| 2565 | v2 = [88, 3, 19, 55, 67, 42, 101, 33, 77, 5, 17, 57, 69, 71, 73, |
| 2566 | 75, 11, 61, 28, 9, 37, 26, 46, 95, 13, 63, 81, 83, 108, 106, |
| 2567 | 48, 97] |
| 2568 | l1 = [35, 93, 1, 24, 53, 7, 44, 59, 15, 65, 79, 21, 110, 90, 50, 99] |
| 2569 | l2 = [87, 4, 18, 56, 68, 41, 102, 32, 12, 62, 29, 84, 38, 105, 47, 96] |
| 2570 | |
| 2571 | d = g.get_pos() |
| 2572 | for i,v in enumerate(v1): |
| 2573 | d[v] = (-2, 16.5-i) |
| 2574 | |
| 2575 | for i,v in enumerate(l1): |
| 2576 | d[v] = (-10, 8-i) |
| 2577 | |
| 2578 | for i,v in enumerate(l2): |
| 2579 | d[v] = (10, 8.5-i) |
| 2580 | |
| 2581 | for i,v in enumerate(v2): |
| 2582 | d[v] = (2, 16.5-i) |
| 2583 | |
| 2584 | for i,v in enumerate([0, 111, 92, 91, 52, 51, 23, 22]): |
| 2585 | d[v] = (-20, 14.5-4*i) |
| 2586 | |
| 2587 | for i,v in enumerate([104, 103, 86, 85, 40, 39, 31, 30]): |
| 2588 | d[v] = (20, 14.5-4*i) |
| 2589 | |
| 2590 | return g |
| 2591 | |
| 2592 | else: |
| 2593 | raise ValueError("The value of embedding must be either 1 or 2") |