summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTara Fife <fi.tara@gmail.com>2016-07-11 14:44:11 -0500
committerTara Fife <fi.tara@gmail.com>2016-07-11 14:44:11 -0500
commitedb861d5fb5ba98d566d5543804264260b1bd140 (patch)
treec02f4123961d7463b777ceb3201fff0ece0e5c7a
parentFile is closer to complete now. (diff)
Added documentation fixed errors
-rw-r--r--src/sage/matroids/cunningham_edmonds_decomposition.pxd10
-rw-r--r--src/sage/matroids/cunningham_edmonds_decomposition.pyx774
2 files changed, 676 insertions, 108 deletions
diff --git a/src/sage/matroids/cunningham_edmonds_decomposition.pxd b/src/sage/matroids/cunningham_edmonds_decomposition.pxd
index 706dfdf..0fa71a5 100644
--- a/src/sage/matroids/cunningham_edmonds_decomposition.pxd
+++ b/src/sage/matroids/cunningham_edmonds_decomposition.pxd
@@ -15,9 +15,9 @@ cdef class Node(sage.structure.sage_object.SageObject):
# def __init__(self, G, pm, int f):
cpdef get_graph(self)
- cdef int get_parent_marker(self)
+ cpdef get_parent_marker(self) # Took out int so it could be called outside from terminal.
cpdef get_parent_marker_edge(self)
- cdef int get_f(self)
+ cpdef get_f(self) # Took out int so it could be called outside from terminal.
cpdef set_f(self, int n)
cpdef is_polygon(self)
cpdef is_path(self, P)
@@ -40,15 +40,15 @@ cdef class CunninghamEdmondsDecomposition(sage.structure.sage_object.SageObject)
cdef int next_vertex
cdef int next_edge
- cpdef __relink1(Q, Z=*, WQ=*)
+ cpdef relink1(self, Q, Z=*, WQ=*)
cpdef __typing(self, P, pi)
cpdef __relink2(Q, Z=*, WQ=*)
cpdef __hypopath(self, P)
# cpdef __squeeze(self, L)
cpdef __update(self, P, C)
cpdef __is_graphic(self)
- cpdef __merge(self, G)
- cpdef merge(self)
+ cpdef merge_with_parent(self, N, N_vertex=*, P_vertex=*)
+ cpdef merge_branch(self, N)
cpdef __add_cycle(self, cycle)
cpdef get_arborescence(self)
cpdef get_nodes(self)
diff --git a/src/sage/matroids/cunningham_edmonds_decomposition.pyx b/src/sage/matroids/cunningham_edmonds_decomposition.pyx
index c0a2a7b..5ddd44a 100644
--- a/src/sage/matroids/cunningham_edmonds_decomposition.pyx
+++ b/src/sage/matroids/cunningham_edmonds_decomposition.pyx
@@ -1,7 +1,7 @@
r"""
Cunningham Edmons decomposition
-These guys are characterized by an abhorence, ``T``, with nodes which are
+These guys are characterized by an aborescence, ``T``, with nodes which are
graphs, and edge names that correspond to the parent marker edges.
Construction
@@ -9,7 +9,7 @@ Construction
-EXAMPLES::
+EXAMPLES:
REFERENCES
==========
@@ -45,38 +45,308 @@ from sage.structure.sage_object import SageObject
cdef class Node(sage.structure.sage_object.SageObject):
+ """
+
+
+ INPUT:
+
+ - ``G`` -- a graph with edge lables and multiedges allowed
+ - ``pm`` -- an edge lable of an edge in ``G``
+ - ``f`` -- and integer representing the way that ``self`` is glued to it's parrent marker.
+ 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_graph()
+ Multi-graph on 10 vertices
+ sage: N.get_graph().edges()
+ [(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)]
+ sage: N.get_parent_marker()
+ 3
+ sage: N.get_parent_marker_edge()
+ (0, 5, 3)
+ sage: N.get_f()
+ -1
+ sage: N.set_f(1)
+ sage: N.get_f()
+ 1
+ sage: N.is_polygon()
+ False
+ sage: N.is_path({1, 2, 3, 4})
+ False
+ sage: N.is_path({1, 3, 4, 7, 11})
+ False
+ sage: N.is_path({1, 2, 9, 12})
+ False
+ sage: N.is_path({1, 2, 4, 6})
+ True
+ sage: N.is_cycle({1, 2, 4, 6})
+ False
+ sage: N.is_cycle({1, 2, 4, 6, 8})
+ True
+ sage: N.typing({1, 4, 7, 11})
+ 1
+ sage: N.typing({1, 2, 4, 7, 11})
+ 2
+ sage: N.typing({1, 4, 6})
+ 3
+ sage: N.typing({1, 4, 6, 12})
+ 4
+ sage: N.typing({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)
+ sage: N = Node(G, 0)
+ sage: N.is_polygon()
+ True
+ sage: N.__relink1({5, 7}, {2, 3, 5, 7, 11}).get_graph().edges()
+ [(0, 1, 3),
+ (0, 11, 0),
+ (1, 2, 2),
+ (2, 3, 11),
+ (3, 4, 5),
+ (4, 5, 1),
+ (5, 6, 4),
+ (6, 7, 6),
+ (7, 8, 8),
+ (8, 9, 9),