# Ticket #3676: trac3676-refactor_graph_isom.patch

File trac3676-refactor_graph_isom.patch, 79.4 KB (added by rlm, 13 years ago)
• ## sage/graphs/graph_generators.py

# HG changeset patch
# User Robert L. Miller <rlm@rlmiller.org>
# Date 1216425781 25200
# Parent  91af4c3f6b92316e4117af342d82be33cf5d949b
Refactored graph isomorphism code

diff -r 91af4c3f6b92 -r 074731a26986 sage/graphs/graph_generators.py
 a class DiGraphGenerators(): import networkx return graph.DiGraph(networkx.gnc_graph(n, seed)) def RandomDirectedGNP(self, n, p): r""" Returns a random digraph on \$n\$ nodes.  Each edge is inserted independently with probability \$p\$. REFERENCES: [1] P. Erdos and A. Renyi, On Random Graphs, Publ. Math. 6, 290 (1959). [2] E. N. Gilbert, Random Graphs, Ann. Math. Stat., 30, 1141 (1959). PLOTTING: When plotting, this graph will use the default spring-layout algorithm, unless a position dictionary is specified. EXAMPLE: sage: digraphs.RandomDirectedGNP(10, .2).num_verts() 10 """ from random import random D = graph.DiGraph(n) for i in xrange(n): for j in xrange(i): if random() < p: D.add_edge(i,j) for j in xrange(i+1,n): if random() < p: D.add_edge(i,j) return D def RandomDirectedGNR(self, n, p, seed=None): """ Returns a random GNR (growing network with redirection) digraph with n
• ## new file sage/groups/perm_gps/partn_ref/__init__.py

diff -r 91af4c3f6b92 -r 074731a26986 sage/groups/perm_gps/partn_ref/__init__.py
• ## new file sage/groups/perm_gps/partn_ref/refinement_graphs.pxd

diff -r 91af4c3f6b92 -r 074731a26986 sage/groups/perm_gps/partn_ref/refinement_graphs.pxd
 - #***************************************************************************** #      Copyright (C) 2006 - 2008 Robert L. Miller # # Distributed  under  the  terms  of  the  GNU  General  Public  License (GPL) #                         http://www.gnu.org/licenses/ #***************************************************************************** include '../../../ext/cdefs.pxi' include '../../../ext/stdsage.pxi' from sage.graphs.base.c_graph cimport CGraph from sage.graphs.base.sparse_graph cimport SparseGraph from sage.graphs.base.dense_graph cimport DenseGraph from sage.rings.integer cimport Integer from sage.groups.perm_gps.partn_ref.tree_traversal cimport PartitionStack, PS_is_discrete, PS_move_min_to_front, PS_num_cells, traverse_tree, traverse_return cdef class GraphStruct: cdef CGraph G cdef bint directed cdef bint use_indicator cdef int *scratch # length 3n+1 cdef int refine_by_degree(PartitionStack *, object, int *, int) cdef int compare_graphs(int *, int *, object) cdef bint all_children_are_equivalent(PartitionStack *, object) cdef int degree(PartitionStack *, CGraph, int, int, bint) cdef int sort_by_function(PartitionStack *, int, int *)
• ## new file sage/groups/perm_gps/partn_ref/refinement_graphs.pyx

diff -r 91af4c3f6b92 -r 074731a26986 sage/groups/perm_gps/partn_ref/refinement_graphs.pyx