1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
# Copyright (c) 1997-2015
# Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
# http://www.polymake.org
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version: http://www.gnu.org/licenses/gpl.txt.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#-------------------------------------------------------------------------------
REQUIRE_EXTENSION bundled:graph_compare
CREDIT graph_compare = bundled:graph_compare
# @category Comparing
# true if //IncidenceMatrix1// and //IncidenceMatrix2// are isomorphic.
# @param IncidenceMatrix IncidenceMatrix1
# @param IncidenceMatrix IncidenceMatrix2
# @return Bool
# @depends bliss or nauty
# @example Compare the incidence matrices of the 2-dimensional cube and cross polytope:
# > $I1 = cube(2)->VERTICES_IN_FACETS;
# > $I2 = cross(2)->VERTICES_IN_FACETS;
# > print isomorphic($I1,$I2);
# | 1
user_function isomorphic(IncidenceMatrix, IncidenceMatrix) : c++ (include => "polymake/graph/compare.h");
# @category Comparing
# true if //graph1// and //graph2// are isomorphic.
# @param props::Graph graph1
# @param props::Graph graph2
# @return Bool
# @depends bliss or nauty
# @example Compare the vertex-edge graph of the square with the cycle graph on 4 nodes:
# > $g1 = cube(2)->GRAPH->ADJACENCY;
# > $g2 = cycle_graph(4)->ADJACENCY;
# > print isomorphic($g1,$g2);
# | 1
user_function isomorphic(props::Graph, props::Graph) : c++ (include => "polymake/graph/compare.h");
# @category Comparing
# Find the node permutation mapping //graph1// to //graph2//.
# If the given graphs are not isomorphic, throw an expection.
# @param props::Graph graph1
# @param props::Graph graph2
# @return Array<Int>
# @depends bliss or nauty
user_function find_node_permutation(props::Graph, props::Graph) : c++ (include => "polymake/graph/compare.h");
# @category Comparing
# Find the permutations mapping the non-symmetric incidence matrix //m1// to //m2//.
# If the given matrices are not isomorphic, throw an expection.
# @param IncidenceMatrix<NonSymmetric> m1
# @param IncidenceMatrix<NonSymmetric> m2
# @return Pair<Array<Int>,Array<Int>> ''first'' permutation applies to the rows, ''second'' applies to the columns
# @depends bliss or nauty
# @example > $m1 = new IncidenceMatrix([1,2],[5,3]);
# > $m2 = new IncidenceMatrix([4,3],[1,5]);
# > print find_row_col_permutation($m1,$m2);
# | <1 0> <0 1 4 3 5 2>
user_function find_row_col_permutation(IncidenceMatrix<NonSymmetric>, IncidenceMatrix<NonSymmetric>) \
: c++ (include => "polymake/graph/compare.h");
# @category Comparing
# Find the automorphism group of the graph.
# @param props::Graph graph
# @return Array<Array<Int>> each element encodes a node permutation.
# @depends bliss or nauty
# @example We first create the vertex-edge graph of the square and then print its automorphism group:
# > $g=new props::Graph(cube(2)->GRAPH->ADJACENCY);
# > print automorphisms($g);
# | 0 2 1 3
# | 1 0 3 2
# These two permutations generate the group of all node permutations
# that preserve vertex-edge connectivity.
user_function automorphisms(props::Graph) : c++ (include => "polymake/graph/compare.h");
# @category Comparing
# Find the order of the automorphism group of the graph.
# @param props::Graph graph
# @return Int the order of the automorphism group
# @depends bliss or nauty
# @example > print n_automorphisms(cycle_graph(5)->ADJACENCY);
# | 2
user_function n_automorphisms(props::Graph) : c++ (include => "polymake/graph/GraphIso.h");
# @category Comparing
# Find the automorphism group of the non-symmetric incidence matrix.
# @param IncidenceMatrix<NonSymmetric> m
# @return Array<Pair<Array<Int>,Array<Int>>> each element encodes a permutation of its rows (''first'') and columns (''second'').
# @depends bliss or nauty
# @example The group of combinatorial automorphisms of the 3-cube coincides with
# the group of (bipartite) graph automorphisms of the vertex/facet incidences.
# To print this group, type this:
# > print automorphisms(cube(3)->VERTICES_IN_FACETS);
# | (<0 1 4 5 2 3> <0 1 4 5 2 3 6 7>)
# | (<2 3 0 1 4 5> <0 2 1 3 4 6 5 7>)
# | (<1 0 2 3 4 5> <1 0 3 2 5 4 7 6>)
# This means that the group is generated by three elements, one per line in the output.
# Each is written as a pair of permutations. The first gives the action on the facets,
# the second the action on the vertices.
user_function automorphisms(IncidenceMatrix<NonSymmetric>) : c++ (include => "polymake/graph/compare.h");
# @category Comparing
# Find the automorphism group of the symmetric incidence matrix.
# @param IncidenceMatrix<Symmetric> m
# @return Array<Array<Int>> each element encodes a permutation of its rows (=columns).
# @depends bliss or nauty
user_function automorphisms(IncidenceMatrix<Symmetric>) : c++ (include => "polymake/graph/compare.h");
object Graph {
# @notest Rule defined "in stock" - currently without use
rule NodePerm.PERMUTATION : NodePerm.ADJACENCY, ADJACENCY {
$this->NodePerm->PERMUTATION=find_node_permutation($this->NodePerm->ADJACENCY, $this->ADJACENCY);
}
weight 5.10;
}
# Local Variables:
# mode: perl
# cperl-indent-level:3
# indent-tabs-mode:nil
# End:
|