Re: YAML declarativeness
Oren Ben-Kiki <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <1272589787.2330.6.camel@nero> |
Interesting... but it I don't get it.
It seems to me YAML can be used to serialize any cyclical structure,
including the one you described:
On Wed, 2010-02-10 at 01:00 -0500, Devin Jeanpierre wrote:
> It is true for an undirected graph. It is not true for a directed
> graph, unless the trees are allowed to not span as much of the graph
> as they can. Supposing we want spanning trees, the following graph
> works against us:
>
> a->b->d;a->c->d
>
> Our hand is forced in producing the first part of the spanning tree,
> a->b; a->c . Either b or c can get d as a child, but at that point we
> are forced to produce a cross edge that does not point to an ancestor,
> but to the sibling's child.
That's the part I don't get. You emit a->b first, then a->c second. Ok.
You can now emit, say, b->d, and give an anchor to d. Now emit c->d, but
use a reference to that anchor. What am I missing?
You could also present it directly as a graph:
a:
data: ...
children:
b:
data: ...
children:
d: &d
data: ...
children: {}
c:
data: ...
children:
d: *d
Or maybe (if you want to avoid repeating the name):
name: a
data : ...
children:
? name: b
data: ...
children: &d
? name: d
data: ...
children: {}
? name: c
data: ...
children:
? *d
Or something along these lines.
Have fun,
Oren Ben-Kiki
------------------------------------------------------------------------------