#16246: Add functions calculating all spanning trees, all bridges in a graph
-----------------------------------------+------------------------
Reporter: jdickinson | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone: sage-6.2
Component: graph theory | Resolution:
Keywords: bridge, spanning tree | Merged in:
Authors: Jennet Dickinson | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-----------------------------------------+------------------------
Changes (by jdickinson):
* changetime: 04/27/14 05:46:36 => 04/27/14 05:46:36
* time: 04/26/14 14:48:37 => 04/26/14 14:48:37
Old description:
> This patch adds
>
> 1) a function that finds all spanning trees in a graph.
> (adapted from "Bounds on Backtrack Algorithms for Listing Cycles, Paths,
> and Spanning Trees" R. C. Read and R. E. Tarjan, 1975)
>
> 2) a function that finds all bridges in a graph recursively, that is used
> in calculating the spanning trees
> (adapted from the solution to 4.1.36 in Sedgewick's _Algorithms_ 4th ed.)
>
> For example:
>
> {{{
> sage: G = Graph([(1,2),(1,2),(1,3),(1,3),(2,3),(1,4)])
> sage: G.spanning_trees()
> [Graph on 4 vertices,
> Graph on 4 vertices,
> Graph on 4 vertices,
> Graph on 4 vertices,
> Graph on 4 vertices,
> Graph on 4 vertices,
> Graph on 4 vertices,
> Graph on 4 vertices]
> sage: len(G.spanning_trees()) == G.spanning_trees_count()
> True
> sage: G.bridges()
> [(1, 4, None)]
> }}}
> These functions will assist in the calculation of the Jones polynomial of
> a knot.
New description:
This patch adds
1) a function that finds all spanning trees in a graph.
(adapted from "Bounds on Backtrack Algorithms for Listing Cycles, Paths,
and Spanning Trees" R. C. Read and R. E. Tarjan, 1975)
2) a function that finds all bridges in a graph recursively, that is used
in calculating the spanning trees
(adapted from the solution to 4.1.36 in Sedgewick's _Algorithms_ 4th ed.)
For example:
{{{
sage: G = Graph([(1,2),(1,2),(1,3),(1,3),(2,3),(1,4)])
sage: G.spanning_trees()
[Graph on 4 vertices,
Graph on 4 vertices,
Graph on 4 vertices,
Graph on 4 vertices,
Graph on 4 vertices,
Graph on 4 vertices,
Graph on 4 vertices,
Graph on 4 vertices]
sage: len(G.spanning_trees()) == G.spanning_trees_count()
True
sage: G.bridges()
[(1, 4, None)]
}}}
These functions will assist in the calculation of the Jones polynomial of
a knot.
--
--
Ticket URL: <http://trac.sagemath.org/ticket/16246#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.