init commit again

This commit is contained in:
Peter
2023-11-01 09:29:33 +01:00
parent 448147e7da
commit d6c745207b
250 changed files with 15552 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
### Graphs
[
Type directed-graphs
Funcon is-cyclic
Funcon topological-sort
]
Meta-variables
GT <: ground-values
Type
directed-graphs(GT) ~> maps(GT, sets(GT))
/*
`directed-graphs(GT)` models directed graphs with vertices of type `GT`,
represented as maps from vertices to the set of vertices to which the
vertex has an edge. E.g., the graph
(1)--->(2)
would be represented as `{ 1 |-> {2}, 2 |-> {} }`
*/
Built-in Funcon
is-cyclic(_:directed-graphs(GT)) : =>booleans
Built-in Funcon
topological-sort(_:directed-graphs(GT)) : =>(GT)*
/*
`topological-sort(DG)` returns a topological ordering of the vertices
of the graph `DG`, as a sequence of vertices, provided that `DG` is not
cyclic.
*/

View File

@@ -0,0 +1,69 @@
---
layout: default
title: "Graphs"
parent: Composite
ancestor: Funcons-beta
---
[Funcons-beta] : [Graphs.cbs]
-----------------------------
### Graphs
<div class="highlighter-rouge"><pre class="highlight"><code>[
<i class="keyword">Type</i> <span class="name"><a href="#Name_directed-graphs">directed-graphs</a></span>
<i class="keyword">Funcon</i> <span class="name"><a href="#Name_is-cyclic">is-cyclic</a></span>
<i class="keyword">Funcon</i> <span class="name"><a href="#Name_topological-sort">topological-sort</a></span>
]</code></pre></div>
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Meta-variables</i>
<span id="PartVariable_GT"><i class="var">GT</i></span> <: <span class="name"><a href="../../Value-Types/index.html#Name_ground-values">ground-values</a></span></code></pre></div>
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Type</i>
<span class="name"><span id="Name_directed-graphs">directed-graphs</span></span>(<span id="Variable40_GT"><i class="var">GT</i></span>) ~> <span class="name"><a href="../Maps/index.html#Name_maps">maps</a></span>(<a href="#Variable40_GT"><i class="var">GT</i></a>, <span class="name"><a href="../Sets/index.html#Name_sets">sets</a></span>(<a href="#Variable40_GT"><i class="var">GT</i></a>))</code></pre></div>
<code><span class="name"><a href="#Name_directed-graphs">directed-graphs</a></span>(<i class="var">GT</i>)</code> models directed graphs with vertices of type <code><i class="var">GT</i></code>,
represented as maps from vertices to the set of vertices to which the
vertex has an edge. E.g., the graph
(1)--->(2)
would be represented as <code>{ 1 |-> {2}, 2 |-> {} }</code>
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Built-in</i> <i class="keyword">Funcon</i>
<span class="name"><span id="Name_is-cyclic">is-cyclic</span></span>(_:<span class="name"><a href="#Name_directed-graphs">directed-graphs</a></span>(<span id="Variable155_GT"><i class="var">GT</i></span>)) : =><span class="name"><a href="../../Primitive/Booleans/index.html#Name_booleans">booleans</a></span></code></pre></div>
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Built-in</i> <i class="keyword">Funcon</i>
<span class="name"><span id="Name_topological-sort">topological-sort</span></span>(_:<span class="name"><a href="#Name_directed-graphs">directed-graphs</a></span>(<span id="Variable186_GT"><i class="var">GT</i></span>)) : =>(<span id="Variable206_GT"><i class="var">GT</i></span>)<sup class="sup">*</sup></code></pre></div>
<code><span class="name"><a href="#Name_topological-sort">topological-sort</a></span>(<i class="var">DG</i>)</code> returns a topological ordering of the vertices
of the graph <code><i class="var">DG</i></code>, as a sequence of vertices, provided that <code><i class="var">DG</i></code> is not
cyclic.
____
From the [PLanCompS Project] | [CBS-beta issues...] | [Suggest an improvement...]
[Graphs.cbs]: Graphs.cbs
"CBS SOURCE FILE"
[Funcons-beta]: /CBS-beta/docs/Funcons-beta
"FUNCONS-BETA"
[Unstable-Funcons-beta]: /CBS-beta/docs/Unstable-Funcons-beta
"UNSTABLE-FUNCONS-BETA"
[Languages-beta]: /CBS-beta/docs/Languages-beta
"LANGUAGES-BETA"
[Unstable-Languages-beta]: /CBS-beta/docs/Unstable-Languages-beta
"UNSTABLE-LANGUAGES-BETA"
[CBS-beta]: /CBS-beta "CBS-BETA"
[PLanCompS Project]: https://plancomps.github.io
"PROGRAMMING LANGUAGE COMPONENTS AND SPECIFICATIONS PROJECT HOME PAGE"
[CBS-beta issues...]: https://github.com/plancomps/CBS-beta/issues
"CBS-BETA ISSUE REPORTS ON GITHUB"
[Suggest an improvement...]: mailto:plancomps@gmail.com?Subject=CBS-beta%20-%20comment&Body=Re%3A%20CBS-beta%20specification%20at%20Values/Composite/Graphs/Graphs.cbs%0A%0AComment/Query/Issue/Suggestion%3A%0A%0A%0ASignature%3A%0A
"GENERATE AN EMAIL TEMPLATE"