summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTara Fife <fi.tara@gmail.com>2016-08-11 22:46:13 -0500
committerTara Fife <fi.tara@gmail.com>2016-08-11 22:46:13 -0500
commitba510d23369de9a77bd3caab5a85ae69b1efc88f (patch)
treebe5a90004ce9764598eadc2fa8f370437b5abe7a
parentadded get D_hat (diff)
Infinate recursion?u/tara/graphicness_test
I can't quickly see how I created this.
-rw-r--r--src/sage/matroids/cunningham_edmonds_decomposition.pxd8
-rw-r--r--src/sage/matroids/cunningham_edmonds_decomposition.pyx178
2 files changed, 128 insertions, 58 deletions
diff --git a/src/sage/matroids/cunningham_edmonds_decomposition.pxd b/src/sage/matroids/cunningham_edmonds_decomposition.pxd
index b2ae352..c33e41b 100644
--- a/src/sage/matroids/cunningham_edmonds_decomposition.pxd
+++ b/src/sage/matroids/cunningham_edmonds_decomposition.pxd
@@ -12,7 +12,8 @@ cdef class Node(sage.structure.sage_object.SageObject):
cpdef graph
cdef int parent_marker
cdef int f
- # cdef int parent_marker_vertex
+ cdef int parent_marker_vertex
+ cdef int T
# def __init__(self, G, pm, int f):
cpdef get_graph(self)
@@ -24,9 +25,11 @@ cdef class Node(sage.structure.sage_object.SageObject):
cpdef is_polygon(self)
cpdef is_path(self, P)
cpdef is_cycle(self, P)
- cpdef T(self, P)
+ cpdef T(self, P, Z)
cpdef __relink1(self, Z=*, WQ=*)
cpdef __relink2(self, Z=*, WQ=*)
+ cpdef get_T(self)
+ cpdef set_T(self, int T)
@@ -44,6 +47,7 @@ cdef class CunninghamEdmondsDecomposition(sage.structure.sage_object.SageObject)
cpdef relink1(self, Q, Z=*, WQ=*)
cpdef get_D_hat(self, P)
+ cpdef T(self, N, P, T)
cpdef __typing(self, P, pi)
cpdef __relink2(Q, Z=*, WQ=*)
cpdef __hypopath(self, P)
diff --git a/src/sage/matroids/cunningham_edmonds_decomposition.pyx b/src/sage/matroids/cunningham_edmonds_decomposition.pyx
index d54e279..1bee189 100644
--- a/src/sage/matroids/cunningham_edmonds_decomposition.pyx
+++ b/src/sage/matroids/cunningham_edmonds_decomposition.pyx
@@ -101,16 +101,17 @@ cdef class Node(sage.structure.sage_object.SageObject):
False
sage: N.is_cycle({1, 2, 4, 6, 8})
True
- sage: N.T({1, 4, 7, 11})
- 1
- sage: N.T({1, 2, 4, 7, 11})
- 2
- sage: N.T({1, 4, 6})
- 3
- sage: N.T({1, 4, 6, 12})
- 4
- sage: N.T({1, 2, 4, 8})
- 5
+
+ # sage: N.T({1, 4, 7, 11}, {})
+ # 1
+ # sage: N.T({1, 2, 4, 7, 11}, {})
+ # 2
+ # sage: N.T({1, 4, 6}, {})
+ # 3
+ # sage: N.T({1, 4, 6, 12}, {})
+ # 4
+ # sage: N.T({1, 2, 4, 8}, {})
+ # 5
sage: G= Graph([(0, 1, 1), (1, 2, 2), (2, 3, 3), (3, 4, 4), (4, 5, 5), (5, 6, 6), (6, 7, 7), (7, 8, 8), (8, 9, 9), (9, 10, 10), (10, 11, 11), (11, 0, 0)], multiedges=True)
@@ -248,11 +249,10 @@ cdef class Node(sage.structure.sage_object.SageObject):
self.graph = G
self.parent_marker = pm
self.f = f
- # for g in G.edges():
- # if g.lable() == pm:
- # e = g
- # self.parent_marker_vertex = e[1]
-
+ for g in G.edges():
+ if g[2] == pm:
+ self.parent_marker_vertex = g[1]
+ self.T = 0
cpdef get_graph(self):
r"""
@@ -357,6 +357,36 @@ cdef class Node(sage.structure.sage_object.SageObject):
return None
+ cpdef get_T(self):
+ r"""
+ EXAMPLES:
+
+ sage: from sage.matroids.cunningham_edmonds_decomposition import *
+ sage: G= Graph([(0, 1, 1), (0, 4, 2), (0, 5, 3), (1, 2, 4), (1, 6, 5), (2, 3, 6), (2, 7, 7), (3, 4, 8), (3, 8, 9), (4, 9, 10), (5, 7, 11), (5, 8, 12), (6, 8, 13), (6, 9, 14), (7, 9, 15)], multiedges=True)
+ sage: N = Node(G, 3)
+ sage: N.get_T()
+ 0
+ """
+ return self.T
+
+
+ cpdef set_T(self, int T):
+ r"""
+ EXAMPLES:
+
+ sage: from sage.matroids.cunningham_edmonds_decomposition import *
+ sage: G= Graph([(0, 1, 1), (0, 4, 2), (0, 5, 3), (1, 2, 4), (1, 6, 5), (2, 3, 6), (2, 7, 7), (3, 4, 8), (3, 8, 9), (4, 9, 10), (5, 7, 11), (5, 8, 12), (6, 8, 13), (6, 9, 14), (7, 9, 15)], multiedges=True)
+ sage: N = Node(G, 3)
+
+ sage: N.get_f()
+ -1
+ sage: N.set_f(1)
+ sage: N.get_f()
+ 1
+ """
+ self.T = T
+ return None
+
cpdef is_polygon(self):
r"""
EXAMPLES:
@@ -437,28 +467,28 @@ cdef class Node(sage.structure.sage_object.SageObject):
return True
- cpdef T(self, P):
+ cpdef T(self, P, Z):
r"""
EXAMPLES:
sage: from sage.matroids.cunningham_edmonds_decomposition import *
sage: G= Graph([(0, 1, 1), (0, 4, 2), (0, 5, 3), (1, 2, 4), (1, 6, 5), (2, 3, 6), (2, 7, 7), (3, 4, 8), (3, 8, 9), (4, 9, 10), (5, 7, 11), (5, 8, 12), (6, 8, 13), (6, 9, 14), (7, 9, 15)], multiedges=True)
sage: N = Node(G, 3)
- sage: N.T({1, 4, 7, 11})
+ sage: N.T({1, 4, 7, 11}, {})
1
- sage: N.T({1, 2, 4, 7, 11})
+ sage: N.T({1, 2, 4, 7, 11}, {})
2
- sage: N.T({1, 4, 6})
+ sage: N.T({1,