Archive
Archive for May, 2010
On reproducible research
16 May 2010
1 comment
- Sage and the future of mathematics, David Joyner
- Reproducible research and computational biology, Grant Jacobs
- WaveLab and Reproducible Research, J. B. Buckheit and D. L. Donoho
- Reproducible Research Planet!
- Call For Scientific Research Code To Be Released, on Slashdot
- Victoria Stodden
- Keeping computers from ending science’s reproducibility, on Ars Technica
Categories: documentation, ethics
ethics, research ethics
Random oriented graphs
15 May 2010
Leave a comment
This one is from a recent sage-support thread.
Problem
Let be a digraph and let
be vertices of
. Then
is said to be oriented if at most one of
is an edge of
. This means that
might not contain any of the edges
. However, if
, then
and vice versa. The problem now is to generate a random oriented graph.
Solution
A quick-and-dirty solution is as follows:
- Generate a random graph
with RanomGNP, i.e.
is undirected.
- Let
be the digraph version of
, i.e. if
is an edge of
, then
is also an edge.
- Let
be the edge removal probability.
- For each edge
, generate a cutoff probability
. If
, remove
from the digraph
. Otherwise
, so we remove
from
.
Here is sample code using Sage 4.4.1 illustrating the above procedure:
sage: G = graphs.RandomGNP(10, random()) sage: G.edges(labels=False) [(0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 8), (1, 2), (1, 3), (1, 5), (1, 7), (1, 8), (2, 4), (2, 6), (2, 8), (2, 9), (3, 4), (3, 6), (3, 7), (3, 8), (3, 9), (4, 5), (4, 9), (5, 6), (5, 8), (5, 9), (6, 9), (7, 8), (8, 9)] sage: D = G.to_directed() sage: D.edges(labels=False) [(0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 8), (1, 2), (1, 3), (1, 5), (1, 7), (1, 8), (2, 0), (2, 1), (2, 4), (2, 6), (2, 8), (2, 9), (3, 0), (3, 1), (3, 4), (3, 6), (3, 7), (3, 8), (3, 9), (4, 0), (4, 2), (4, 3), (4, 5), (4, 9), (5, 0), (5, 1), (5, 4), (5, 6), (5, 8), (5, 9), (6, 0), (6, 2), (6, 3), (6, 5), (6, 9), (7, 1), (7, 3), (7, 8), (8, 0), (8, 1), (8, 2), (8, 3), (8, 5), (8, 7), (8, 9), (9, 2), (9, 3), (9, 4), (9, 5), (9, 6), (9, 8)] sage: D.size() 56 sage: P = random(); P 0.55638632541078259 sage: for u, v in G.edge_iterator(labels=False): ....: p = random() ....: if p <= P: ....: D.delete_edge(u, v) ....: else: ....: D.delete_edge(v, u) ....: sage: D.edges(labels=False) [(0, 2), (0, 3), (0, 6), (1, 2), (1, 5), (2, 8), (3, 1), (3, 6), (3, 8), (3, 9), (4, 0), (4, 2), (4, 3), (4, 5), (5, 0), (6, 2), (6, 5), (6, 9), (7, 1), (7, 3), (8, 0), (8, 1), (8, 5), (8, 7), (9, 2), (9, 4), (9, 5), (9, 8)] sage: D.size() 28
Categories: documentation, graph theory, Sage
documentation, graph theory, mathematics, primer, Sage, tutorial
Sage 4.4.2 release schedule
7 May 2010
Leave a comment
Sage 4.4.2 is intended to be a little release on the way to Sage 5.0. I’m devoting a week or so to managing the release of Sage 4.4.2. Here’s a proposed release schedule I posted to sage-release:
- Sage 4.4.2.alpha0 — release 10th May 2010
- Sage 4.4.2.rc0 — feature freeze; release 15th May 2010
- Anything critical to get Sage 4.4.2.final to stabilize
- Sage 4.4.2.final — release 18th May 2010
I’m being too optimistic here with the above schedule. But we’ll see how things go.