1
0
Fork 0
mirror of https://github.com/mfocko/blog.git synced 2025-05-10 21:32:59 +02:00

chore: transfer all KBs to single one

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-11-05 15:24:54 +01:00
parent d207e870d4
commit 7427475022
Signed by: mfocko
GPG key ID: 7C47D46246790496
159 changed files with 28847 additions and 0 deletions

View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: %0 Pages: 1 -->
<svg width="189pt" height="404pt" viewBox="0.00 0.00 189.00 404.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 400)">
<title>%0</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-400 185,-400 185,4 -4,4"/>
<!-- a -->
<g id="node1" class="node">
<title>a</title>
<ellipse fill="none" stroke="#000000" cx="126" cy="-378" rx="27" ry="18"/>
<text text-anchor="middle" x="126" y="-373.8" font-family="Times,serif" font-size="14.00" fill="#000000">a</text>
</g>
<!-- c -->
<g id="node2" class="node">
<title>c</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-306" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-301.8" font-family="Times,serif" font-size="14.00" fill="#000000">c</text>
</g>
<!-- a&#45;&#45;c -->
<g id="edge1" class="edge">
<title>a--c</title>
<path fill="none" stroke="#000000" d="M119.3258,-360.2022C115.1407,-349.0419 109.7679,-334.7143 105.5974,-323.593"/>
</g>
<!-- e -->
<g id="node3" class="node">
<title>e</title>
<ellipse fill="none" stroke="#000000" cx="154" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="154" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">e</text>
</g>
<!-- a&#45;&#45;e -->
<g id="edge2" class="edge">
<title>a--e</title>
<path fill="none" stroke="#000000" d="M129.2182,-360.0337C131.0409,-349.5449 133.2909,-336.0449 135,-324 142.3994,-271.8513 149.0765,-209.9625 152.1748,-180.0161"/>
</g>
<!-- i -->
<g id="node4" class="node">
<title>i</title>
<ellipse fill="none" stroke="#000000" cx="27" cy="-234" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">i</text>
</g>
<!-- c&#45;&#45;i -->
<g id="edge3" class="edge">
<title>c--i</title>
<path fill="none" stroke="#000000" d="M83.7307,-290.7307C71.512,-278.512 54.4602,-261.4602 42.2473,-249.2473"/>
</g>
<!-- b -->
<g id="node5" class="node">
<title>b</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-234" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">b</text>
</g>
<!-- c&#45;&#45;b -->
<g id="edge4" class="edge">
<title>c--b</title>
<path fill="none" stroke="#000000" d="M99,-287.8314C99,-277 99,-263.2876 99,-252.4133"/>
</g>
<!-- j -->
<g id="node6" class="node">
<title>j</title>
<ellipse fill="none" stroke="#000000" cx="126" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="126" y="-13.8" font-family="Times,serif" font-size="14.00" fill="#000000">j</text>
</g>
<!-- e&#45;&#45;j -->
<g id="edge5" class="edge">
<title>e--j</title>
<path fill="none" stroke="#000000" d="M150.5104,-144.0535C145.1449,-116.4592 134.9255,-63.9026 129.5336,-36.1727"/>
</g>
<!-- d -->
<g id="node7" class="node">
<title>d</title>
<ellipse fill="none" stroke="#000000" cx="36" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="36" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">d</text>
</g>
<!-- i&#45;&#45;d -->
<g id="edge6" class="edge">
<title>i--d</title>
<path fill="none" stroke="#000000" d="M29.2711,-215.8314C30.625,-205 32.3391,-191.2876 33.6983,-180.4133"/>
</g>
<!-- h -->
<g id="node8" class="node">
<title>h</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">h</text>
</g>
<!-- b&#45;&#45;h -->
<g id="edge7" class="edge">
<title>b--h</title>
<path fill="none" stroke="#000000" d="M99,-215.7623C99,-188.0633 99,-135.7005 99,-108.0896"/>
</g>
<!-- d&#45;&#45;h -->
<g id="edge8" class="edge">
<title>d--h</title>
<path fill="none" stroke="#000000" d="M49.6701,-146.3771C60.2373,-134.3003 74.7961,-117.6616 85.3566,-105.5924"/>
</g>
<!-- h&#45;&#45;j -->
<g id="edge9" class="edge">
<title>h--j</title>
<path fill="none" stroke="#000000" d="M105.6742,-72.2022C109.8593,-61.0419 115.2321,-46.7143 119.4026,-35.593"/>
</g>
</g>
</svg>

After

(image error) Size: 4.2 KiB

View file

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: %0 Pages: 1 -->
<svg width="189pt" height="404pt" viewBox="0.00 0.00 189.00 404.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 400)">
<title>%0</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-400 185,-400 185,4 -4,4"/>
<!-- a -->
<g id="node1" class="node">
<title>a</title>
<ellipse fill="none" stroke="#000000" cx="126" cy="-378" rx="27" ry="18"/>
<text text-anchor="middle" x="126" y="-373.8" font-family="Times,serif" font-size="14.00" fill="#000000">a</text>
</g>
<!-- c -->
<g id="node2" class="node">
<title>c</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-306" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-301.8" font-family="Times,serif" font-size="14.00" fill="#000000">c</text>
</g>
<!-- a&#45;&#45;c -->
<g id="edge1" class="edge">
<title>a--c</title>
<path fill="none" stroke="#000000" d="M119.3258,-360.2022C115.1407,-349.0419 109.7679,-334.7143 105.5974,-323.593"/>
</g>
<!-- e -->
<g id="node3" class="node">
<title>e</title>
<ellipse fill="none" stroke="#000000" cx="154" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="154" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">e</text>
</g>
<!-- a&#45;&#45;e -->
<g id="edge2" class="edge">
<title>a--e</title>
<path fill="none" stroke="#000000" d="M129.2182,-360.0337C131.0409,-349.5449 133.2909,-336.0449 135,-324 142.3994,-271.8513 149.0765,-209.9625 152.1748,-180.0161"/>
</g>
<!-- i -->
<g id="node4" class="node">
<title>i</title>
<ellipse fill="none" stroke="#000000" cx="27" cy="-234" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">i</text>
</g>
<!-- c&#45;&#45;i -->
<g id="edge3" class="edge">
<title>c--i</title>
<path fill="none" stroke="#000000" d="M83.7307,-290.7307C71.512,-278.512 54.4602,-261.4602 42.2473,-249.2473"/>
</g>
<!-- b -->
<g id="node5" class="node">
<title>b</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-234" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">b</text>
</g>
<!-- c&#45;&#45;b -->
<g id="edge4" class="edge">
<title>c--b</title>
<path fill="none" stroke="#000000" d="M99,-287.8314C99,-277 99,-263.2876 99,-252.4133"/>
</g>
<!-- j -->
<g id="node6" class="node">
<title>j</title>
<ellipse fill="none" stroke="#000000" cx="126" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="126" y="-13.8" font-family="Times,serif" font-size="14.00" fill="#000000">j</text>
</g>
<!-- e&#45;&#45;j -->
<g id="edge5" class="edge">
<title>e--j</title>
<path fill="none" stroke="#000000" d="M150.5104,-144.0535C145.1449,-116.4592 134.9255,-63.9026 129.5336,-36.1727"/>
</g>
<!-- h -->
<g id="node7" class="node">
<title>h</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">h</text>
</g>
<!-- e&#45;&#45;h -->
<g id="edge6" class="edge">
<title>e--h</title>
<path fill="none" stroke="#000000" d="M141.5196,-145.6621C132.5186,-133.8788 120.4207,-118.0416 111.431,-106.2733"/>
</g>
<!-- d -->
<g id="node8" class="node">
<title>d</title>
<ellipse fill="none" stroke="#000000" cx="35" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="35" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">d</text>
</g>
<!-- i&#45;&#45;d -->
<g id="edge7" class="edge">
<title>i--d</title>
<path fill="none" stroke="#000000" d="M29.0187,-215.8314C30.2222,-205 31.7458,-191.2876 32.9541,-180.4133"/>
</g>
<!-- b&#45;&#45;h -->
<g id="edge8" class="edge">
<title>b--h</title>
<path fill="none" stroke="#000000" d="M99,-215.7623C99,-188.0633 99,-135.7005 99,-108.0896"/>
</g>
<!-- h&#45;&#45;j -->
<g id="edge10" class="edge">
<title>h--j</title>
<path fill="none" stroke="#000000" d="M105.6742,-72.2022C109.8593,-61.0419 115.2321,-46.7143 119.4026,-35.593"/>
</g>
<!-- d&#45;&#45;h -->
<g id="edge9" class="edge">
<title>d--h</title>
<path fill="none" stroke="#000000" d="M48.887,-146.3771C59.622,-134.3003 74.4119,-117.6616 85.1401,-105.5924"/>
</g>
</g>
</svg>

After

(image error) Size: 4.4 KiB

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: %0 Pages: 1 -->
<svg width="206pt" height="260pt" viewBox="0.00 0.00 206.00 260.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 256)">
<title>%0</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-256 202,-256 202,4 -4,4"/>
<!-- a -->
<g id="node1" class="node">
<title>a</title>
<ellipse fill="none" stroke="#000000" cx="135" cy="-234" rx="27" ry="18"/>
<text text-anchor="middle" x="135" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">a</text>
</g>
<!-- c -->
<g id="node2" class="node">
<title>c</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">c</text>
</g>
<!-- a&#45;&gt;c -->
<g id="edge1" class="edge">
<title>a-&gt;c</title>
<path fill="none" stroke="#000000" d="M126.2854,-216.5708C122.0403,-208.0807 116.8464,-197.6929 112.1337,-188.2674"/>
<polygon fill="#000000" stroke="#000000" points="115.237,-186.6477 107.6343,-179.2687 108.976,-189.7782 115.237,-186.6477"/>
</g>
<!-- e -->
<g id="node3" class="node">
<title>e</title>
<ellipse fill="none" stroke="#000000" cx="171" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="171" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">e</text>
</g>
<!-- a&#45;&gt;e -->
<g id="edge2" class="edge">
<title>a-&gt;e</title>
<path fill="none" stroke="#000000" d="M143.7146,-216.5708C147.9597,-208.0807 153.1536,-197.6929 157.8663,-188.2674"/>
<polygon fill="#000000" stroke="#000000" points="161.024,-189.7782 162.3657,-179.2687 154.763,-186.6477 161.024,-189.7782"/>
</g>
<!-- b -->
<g id="node4" class="node">
<title>b</title>
<ellipse fill="none" stroke="#000000" cx="27" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">b</text>
</g>
<!-- c&#45;&gt;b -->
<g id="edge3" class="edge">
<title>c-&gt;b</title>
<path fill="none" stroke="#000000" d="M83.7307,-146.7307C73.803,-136.803 60.6847,-123.6847 49.5637,-112.5637"/>
<polygon fill="#000000" stroke="#000000" points="51.7933,-109.8436 42.2473,-105.2473 46.8436,-114.7933 51.7933,-109.8436"/>
</g>
<!-- i -->
<g id="node5" class="node">
<title>i</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">i</text>
</g>
<!-- c&#45;&gt;i -->
<g id="edge4" class="edge">
<title>c-&gt;i</title>
<path fill="none" stroke="#000000" d="M99,-143.8314C99,-136.131 99,-126.9743 99,-118.4166"/>
<polygon fill="#000000" stroke="#000000" points="102.5001,-118.4132 99,-108.4133 95.5001,-118.4133 102.5001,-118.4132"/>
</g>
<!-- j -->
<g id="node6" class="node">
<title>j</title>
<ellipse fill="none" stroke="#000000" cx="171" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="171" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">j</text>
</g>
<!-- e&#45;&gt;j -->
<g id="edge5" class="edge">
<title>e-&gt;j</title>
<path fill="none" stroke="#000000" d="M171,-143.8314C171,-136.131 171,-126.9743 171,-118.4166"/>
<polygon fill="#000000" stroke="#000000" points="174.5001,-118.4132 171,-108.4133 167.5001,-118.4133 174.5001,-118.4132"/>
</g>
<!-- h -->
<g id="node7" class="node">
<title>h</title>
<ellipse fill="none" stroke="#000000" cx="27" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-13.8" font-family="Times,serif" font-size="14.00" fill="#000000">h</text>
</g>
<!-- b&#45;&gt;h -->
<g id="edge6" class="edge">
<title>b-&gt;h</title>
<path fill="none" stroke="#000000" d="M27,-71.8314C27,-64.131 27,-54.9743 27,-46.4166"/>
<polygon fill="#000000" stroke="#000000" points="30.5001,-46.4132 27,-36.4133 23.5001,-46.4133 30.5001,-46.4132"/>
</g>
<!-- d -->
<g id="node8" class="node">
<title>d</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-13.8" font-family="Times,serif" font-size="14.00" fill="#000000">d</text>
</g>
<!-- i&#45;&gt;d -->
<g id="edge7" class="edge">
<title>i-&gt;d</title>
<path fill="none" stroke="#000000" d="M99,-71.8314C99,-64.131 99,-54.9743 99,-46.4166"/>
<polygon fill="#000000" stroke="#000000" points="102.5001,-46.4132 99,-36.4133 95.5001,-46.4133 102.5001,-46.4132"/>
</g>
</g>
</svg>

After

(image error) Size: 4.6 KiB

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: %0 Pages: 1 -->
<svg width="278pt" height="260pt" viewBox="0.00 0.00 278.00 260.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 256)">
<title>%0</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-256 274,-256 274,4 -4,4"/>
<!-- a -->
<g id="node1" class="node">
<title>a</title>
<ellipse fill="none" stroke="#000000" cx="135" cy="-234" rx="27" ry="18"/>
<text text-anchor="middle" x="135" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">a</text>
</g>
<!-- c -->
<g id="node2" class="node">
<title>c</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">c</text>
</g>
<!-- a&#45;&gt;c -->
<g id="edge1" class="edge">
<title>a-&gt;c</title>
<path fill="none" stroke="#000000" d="M126.2854,-216.5708C122.0403,-208.0807 116.8464,-197.6929 112.1337,-188.2674"/>
<polygon fill="#000000" stroke="#000000" points="115.237,-186.6477 107.6343,-179.2687 108.976,-189.7782 115.237,-186.6477"/>
</g>
<!-- e -->
<g id="node3" class="node">
<title>e</title>
<ellipse fill="none" stroke="#000000" cx="171" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="171" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">e</text>
</g>
<!-- a&#45;&gt;e -->
<g id="edge2" class="edge">
<title>a-&gt;e</title>
<path fill="none" stroke="#000000" d="M143.7146,-216.5708C147.9597,-208.0807 153.1536,-197.6929 157.8663,-188.2674"/>
<polygon fill="#000000" stroke="#000000" points="161.024,-189.7782 162.3657,-179.2687 154.763,-186.6477 161.024,-189.7782"/>
</g>
<!-- b -->
<g id="node4" class="node">
<title>b</title>
<ellipse fill="none" stroke="#000000" cx="27" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">b</text>
</g>
<!-- c&#45;&gt;b -->
<g id="edge3" class="edge">
<title>c-&gt;b</title>
<path fill="none" stroke="#000000" d="M83.7307,-146.7307C73.803,-136.803 60.6847,-123.6847 49.5637,-112.5637"/>
<polygon fill="#000000" stroke="#000000" points="51.7933,-109.8436 42.2473,-105.2473 46.8436,-114.7933 51.7933,-109.8436"/>
</g>
<!-- i -->
<g id="node5" class="node">
<title>i</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">i</text>
</g>
<!-- c&#45;&gt;i -->
<g id="edge4" class="edge">
<title>c-&gt;i</title>
<path fill="none" stroke="#000000" d="M99,-143.8314C99,-136.131 99,-126.9743 99,-118.4166"/>
<polygon fill="#000000" stroke="#000000" points="102.5001,-118.4132 99,-108.4133 95.5001,-118.4133 102.5001,-118.4132"/>
</g>
<!-- h -->
<g id="node6" class="node">
<title>h</title>
<ellipse fill="none" stroke="#000000" cx="171" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="171" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">h</text>
</g>
<!-- e&#45;&gt;h -->
<g id="edge5" class="edge">
<title>e-&gt;h</title>
<path fill="none" stroke="#000000" d="M171,-143.8314C171,-136.131 171,-126.9743 171,-118.4166"/>
<polygon fill="#000000" stroke="#000000" points="174.5001,-118.4132 171,-108.4133 167.5001,-118.4133 174.5001,-118.4132"/>
</g>
<!-- j -->
<g id="node7" class="node">
<title>j</title>
<ellipse fill="none" stroke="#000000" cx="243" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="243" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">j</text>
</g>
<!-- e&#45;&gt;j -->
<g id="edge6" class="edge">
<title>e-&gt;j</title>
<path fill="none" stroke="#000000" d="M186.2693,-146.7307C196.197,-136.803 209.3153,-123.6847 220.4363,-112.5637"/>
<polygon fill="#000000" stroke="#000000" points="223.1564,-114.7933 227.7527,-105.2473 218.2067,-109.8436 223.1564,-114.7933"/>
</g>
<!-- d -->
<g id="node8" class="node">
<title>d</title>
<ellipse fill="none" stroke="#000000" cx="99" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-13.8" font-family="Times,serif" font-size="14.00" fill="#000000">d</text>
</g>
<!-- i&#45;&gt;d -->
<g id="edge7" class="edge">
<title>i-&gt;d</title>
<path fill="none" stroke="#000000" d="M99,-71.8314C99,-64.131 99,-54.9743 99,-46.4166"/>
<polygon fill="#000000" stroke="#000000" points="102.5001,-46.4132 99,-36.4133 95.5001,-46.4133 102.5001,-46.4132"/>
</g>
</g>
</svg>

After

(image error) Size: 4.6 KiB

View file

@ -0,0 +1,142 @@
#include "dynlist.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
void dynamic_array_init(struct dynamic_array_t *arr, size_t size)
{
if (arr == NULL)
{
return;
}
arr->data = NULL;
arr->count = 0;
arr->capacity = 0;
arr->size = size;
}
void dynamic_array_destroy(struct dynamic_array_t *arr)
{
if (arr == NULL)
{
return;
}
if (arr->data != NULL)
{
free(arr->data);
arr->data = NULL;
}
arr->count = 0;
arr->capacity = 0;
}
void *dynamic_array_at(struct dynamic_array_t *arr, size_t index)
{
if (arr == NULL || index >= arr->count)
{
return NULL;
}
return arr->data + index * arr->size;
}
void *dynamic_array_front(struct dynamic_array_t *arr)
{
if (arr == NULL || arr->count < 1)
{
return NULL;
}
return arr->data;
}
void *dynamic_array_back(struct dynamic_array_t *arr)
{
if (arr == NULL || arr->count < 1)
{
return NULL;
}
return arr->data + (arr->count - 1) * arr->size;
}
/**
* @brief Resize the dynamic array when needed.
* @param arr Array to be resized.
* @returns <code>true</code> if resizing was successful or array was not resized,
* <code>false</code> otherwise.
*/
static bool dynamic_array_resize(struct dynamic_array_t *arr)
{
if (arr == NULL || arr->count < arr->capacity)
{
return true;
}
size_t new_capacity = arr->capacity ? (arr->capacity * 2) : 16;
void *new_data = realloc(arr->data, new_capacity * arr->size);
if (new_data == NULL)
{
// failed to reallocate memory
return false;
}
arr->data = new_data;
arr->capacity = new_capacity;
return true;
}
bool dynamic_array_push_back(struct dynamic_array_t *arr, void *data)
{
if (arr == NULL || data == NULL)
{
return false;
}
if (!dynamic_array_resize(arr))
{
// failed to reallocate memory
return false;
}
memcpy(dynamic_array_at(arr, arr->count), data, arr->size);
arr->count++;
return true;
}
void dynamic_array_pop_back(struct dynamic_array_t *arr)
{
if (arr == NULL || arr->count < 1)
{
return;
}
arr->count--;
}
void dynamic_array_extend(struct dynamic_array_t *arr, struct dynamic_array_t *src)
{
if (arr == NULL || src == NULL)
{
return;
}
for (size_t i = 0; i < src->count; i++)
{
dynamic_array_push_back(arr, dynamic_array_at(src, i));
}
}
void dynamic_array_clear(struct dynamic_array_t *arr)
{
if (arr == NULL)
{
return;
}
arr->count = 0;
}

View file

@ -0,0 +1,76 @@
#include <stdbool.h>
#include <stdlib.h>
struct dynamic_array_t
{
char *data;
size_t count;
size_t capacity;
size_t size;
};
/**
* @brief Initializes dynamic array. Sets size of single element and zeroes
* everything else.
* @param arr Array to be initialized.
* @param size Size of one element in the array.
*/
void dynamic_array_init(struct dynamic_array_t *arr, size_t size);
/**
* @brief Destroys dynamic array. Deallocates all the memory and resets fields.
* @param arr Array to be destroyed.
*/
void dynamic_array_destroy(struct dynamic_array_t *arr);
/**
* @brief Returns pointer to the element on the given index.
* @param arr Array containing the element.
* @param index Index of the element.
* @returns Pointer to the element, <code>NULL</code> if index is out of bounds.
*/
void *dynamic_array_at(struct dynamic_array_t *arr, size_t index);
/**
* @brief Returns pointer to the first element of the array.
* @param arr Array containing the element.
* @returns Pointer to the first element, <code>NULL</code> if no elements are
* present.
*/
void *dynamic_array_front(struct dynamic_array_t *arr);
/**
* @brief Returns pointer to the last element of the array.
* @param arr Array containing the element.
* @returns Pointer to the last element, <code>NULL</code> if no elements are
* present.
*/
void *dynamic_array_back(struct dynamic_array_t *arr);
/**
* @brief Adds element to the end of the array.
* @param arr Array where the element is to be added.
* @param data Pointer to the data, that are to be copied into the array.
* @returns <code>true</code> if element added successfully, <code>false</code>
* otherwise.
*/
bool dynamic_array_push_back(struct dynamic_array_t *arr, void *data);
/**
* @brief Removes last element from the array.
* @param arr Array from which the last element is to be removed.
*/
void dynamic_array_pop_back(struct dynamic_array_t *arr);
/**
* @brief Extends array with the elements from another array.
* @param arr Array to be extended.
* @param src Array from which the elements are copied.
*/
void dynamic_array_extend(struct dynamic_array_t *arr, struct dynamic_array_t *src);
/**
* @brief Clears out the array.
* @param arr Array to be cleared.
*/
void dynamic_array_clear(struct dynamic_array_t *arr);

View file

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: G Pages: 1 -->
<svg width="638pt" height="209pt" viewBox="0.00 0.00 638.00 208.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 204.8)">
<title>G</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-204.8 634,-204.8 634,4 -4,4"/>
<!-- a_node -->
<g id="node1" class="node">
<title>a_node</title>
<polygon fill="none" stroke="#000000" points="211.5,-164.3 211.5,-200.3 418.5,-200.3 418.5,-164.3 211.5,-164.3"/>
<text text-anchor="middle" x="223" y="-178.1" font-family="Times,serif" font-size="14.00" fill="#000000">1</text>
<polyline fill="none" stroke="#000000" points="234.5,-164.3 234.5,-200.3 "/>
<text text-anchor="middle" x="246" y="-178.1" font-family="Times,serif" font-size="14.00" fill="#000000">2</text>
<polyline fill="none" stroke="#000000" points="257.5,-164.3 257.5,-200.3 "/>
<text text-anchor="middle" x="269" y="-178.1" font-family="Times,serif" font-size="14.00" fill="#000000">3</text>
<polyline fill="none" stroke="#000000" points="280.5,-164.3 280.5,-200.3 "/>
<text text-anchor="middle" x="292" y="-178.1" font-family="Times,serif" font-size="14.00" fill="#000000">4</text>
<polyline fill="none" stroke="#000000" points="303.5,-164.3 303.5,-200.3 "/>
<text text-anchor="middle" x="315" y="-178.1" font-family="Times,serif" font-size="14.00" fill="#000000">5</text>
<polyline fill="none" stroke="#000000" points="326.5,-164.3 326.5,-200.3 "/>
<text text-anchor="middle" x="338" y="-178.1" font-family="Times,serif" font-size="14.00" fill="#000000">6</text>
<polyline fill="none" stroke="#000000" points="349.5,-164.3 349.5,-200.3 "/>
<text text-anchor="middle" x="361" y="-178.1" font-family="Times,serif" font-size="14.00" fill="#000000">7</text>
<polyline fill="none" stroke="#000000" points="372.5,-164.3 372.5,-200.3 "/>
<text text-anchor="middle" x="384" y="-178.1" font-family="Times,serif" font-size="14.00" fill="#000000">8</text>
<polyline fill="none" stroke="#000000" points="395.5,-164.3 395.5,-200.3 "/>
<text text-anchor="middle" x="407" y="-178.1" font-family="Times,serif" font-size="14.00" fill="#000000">9</text>
</g>
<!-- b_node -->
<g id="node2" class="node">
<title>b_node</title>
<polygon fill="none" stroke="#000000" points="100.5,-74.5 100.5,-110.5 169.5,-110.5 169.5,-74.5 100.5,-74.5"/>
<text text-anchor="middle" x="112" y="-88.3" font-family="Times,serif" font-size="14.00" fill="#000000">1</text>
<polyline fill="none" stroke="#000000" points="123.5,-74.5 123.5,-110.5 "/>
<text text-anchor="middle" x="135" y="-88.3" font-family="Times,serif" font-size="14.00" fill="#000000">2</text>
<polyline fill="none" stroke="#000000" points="146.5,-74.5 146.5,-110.5 "/>
<text text-anchor="middle" x="158" y="-88.3" font-family="Times,serif" font-size="14.00" fill="#000000">3</text>
</g>
<!-- a_node&#45;&gt;b_node -->
<g id="edge1" class="edge">
<title>a_node-&gt;b_node</title>
<path fill="none" stroke="#000000" d="M278.5743,-164.1276C249.7143,-149.7297 209.2985,-129.5667 178.6975,-114.3002"/>
<polygon fill="#000000" stroke="#000000" points="180.0501,-111.0637 169.5394,-109.7313 176.9252,-117.3274 180.0501,-111.0637"/>
<text text-anchor="middle" x="246.6683" y="-133.2" font-family="Times,serif" font-size="14.00" fill="#000000">B</text>
</g>
<!-- c_node -->
<g id="node3" class="node">
<title>c_node</title>
<polygon fill="none" stroke="#000000" points="280.5,-74.5 280.5,-110.5 349.5,-110.5 349.5,-74.5 280.5,-74.5"/>
<text text-anchor="middle" x="292" y="-88.3" font-family="Times,serif" font-size="14.00" fill="#000000">4</text>
<polyline fill="none" stroke="#000000" points="303.5,-74.5 303.5,-110.5 "/>
<text text-anchor="middle" x="315" y="-88.3" font-family="Times,serif" font-size="14.00" fill="#000000">5</text>
<polyline fill="none" stroke="#000000" points="326.5,-74.5 326.5,-110.5 "/>
<text text-anchor="middle" x="338" y="-88.3" font-family="Times,serif" font-size="14.00" fill="#000000">6</text>
</g>
<!-- a_node&#45;&gt;c_node -->
<g id="edge2" class="edge">
<title>a_node-&gt;c_node</title>
<path fill="none" stroke="#000000" d="M315,-164.1276C315,-151.7124 315,-135.0106 315,-120.8579"/>
<polygon fill="#000000" stroke="#000000" points="318.5001,-120.6453 315,-110.6453 311.5001,-120.6454 318.5001,-120.6453"/>
<text text-anchor="middle" x="319.6683" y="-133.2" font-family="Times,serif" font-size="14.00" fill="#000000">C</text>
</g>
<!-- d_node -->
<g id="node4" class="node">
<title>d_node</title>
<polygon fill="none" stroke="#000000" points="460.5,-74.5 460.5,-110.5 529.5,-110.5 529.5,-74.5 460.5,-74.5"/>
<text text-anchor="middle" x="472" y="-88.3" font-family="Times,serif" font-size="14.00" fill="#000000">7</text>
<polyline fill="none" stroke="#000000" points="483.5,-74.5 483.5,-110.5 "/>
<text text-anchor="middle" x="495" y="-88.3" font-family="Times,serif" font-size="14.00" fill="#000000">8</text>
<polyline fill="none" stroke="#000000" points="506.5,-74.5 506.5,-110.5 "/>
<text text-anchor="middle" x="518" y="-88.3" font-family="Times,serif" font-size="14.00" fill="#000000">9</text>
</g>
<!-- a_node&#45;&gt;d_node -->
<g id="edge3" class="edge">
<title>a_node-&gt;d_node</title>
<path fill="none" stroke="#000000" d="M351.4257,-164.1276C380.2857,-149.7297 420.7015,-129.5667 451.3025,-114.3002"/>
<polygon fill="#000000" stroke="#000000" points="453.0748,-117.3274 460.4606,-109.7313 449.9499,-111.0637 453.0748,-117.3274"/>
<text text-anchor="middle" x="426.0533" y="-133.2" font-family="Times,serif" font-size="14.00" fill="#000000">D</text>
</g>
<!-- 1 -->
<g id="node5" class="node">
<title>1</title>
<polygon fill="none" stroke="#000000" points="0,-.5 0,-36.5 54,-36.5 54,-.5 0,-.5"/>
<text text-anchor="middle" x="27" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">1</text>
</g>
<!-- b_node&#45;&gt;1 -->
<g id="edge4" class="edge">
<title>b_node-&gt;1</title>
<path fill="none" stroke="#000000" d="M108.5802,-74.3976C94.59,-64.8117 77.2236,-52.9125 62.1142,-42.5597"/>
<polygon fill="#000000" stroke="#000000" points="63.749,-39.4371 53.5213,-36.672 59.7923,-45.2116 63.749,-39.4371"/>
</g>
<!-- 2 -->
<g id="node6" class="node">
<title>2</title>
<polygon fill="none" stroke="#000000" points="72,-.5 72,-36.5 126,-36.5 126,-.5 72,-.5"/>
<text text-anchor="middle" x="99" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">2</text>
</g>
<!-- b_node&#45;&gt;2 -->
<g id="edge5" class="edge">
<title>b_node-&gt;2</title>
<path fill="none" stroke="#000000" d="M126.1011,-74.2079C121.916,-65.6051 116.8401,-55.1713 112.2178,-45.6699"/>
<polygon fill="#000000" stroke="#000000" points="115.3186,-44.0429 107.7965,-36.5817 109.0239,-47.1052 115.3186,-44.0429"/>
</g>
<!-- 3 -->
<g id="node7" class="node">
<title>3</title>
<polygon fill="none" stroke="#000000" points="144,-.5 144,-36.5 198,-36.5 198,-.5 144,-.5"/>
<text text-anchor="middle" x="171" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">3</text>
</g>
<!-- b_node&#45;&gt;3 -->
<g id="edge6" class="edge">
<title>b_node-&gt;3</title>
<path fill="none" stroke="#000000" d="M143.8989,-74.2079C148.084,-65.6051 153.1599,-55.1713 157.7822,-45.6699"/>
<polygon fill="#000000" stroke="#000000" points="160.9761,-47.1052 162.2035,-36.5817 154.6814,-44.0429 160.9761,-47.1052"/>
</g>
<!-- 4 -->
<g id="node8" class="node">
<title>4</title>
<polygon fill="none" stroke="#000000" points="216,-.5 216,-36.5 270,-36.5 270,-.5 216,-.5"/>
<text text-anchor="middle" x="243" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">4</text>
</g>
<!-- c_node&#45;&gt;4 -->
<g id="edge7" class="edge">
<title>c_node-&gt;4</title>
<path fill="none" stroke="#000000" d="M297.2022,-74.2079C288.3088,-65.0674 277.4042,-53.8599 267.7135,-43.9"/>
<polygon fill="#000000" stroke="#000000" points="270.0752,-41.3083 260.593,-36.5817 265.0581,-46.1898 270.0752,-41.3083"/>
</g>
<!-- 5 -->
<g id="node9" class="node">
<title>5</title>
<polygon fill="none" stroke="#000000" points="288,-.5 288,-36.5 342,-36.5 342,-.5 288,-.5"/>
<text text-anchor="middle" x="315" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">5</text>
</g>
<!-- c_node&#45;&gt;5 -->
<g id="edge8" class="edge">
<title>c_node-&gt;5</title>
<path fill="none" stroke="#000000" d="M315,-74.2079C315,-65.9635 315,-56.0376 315,-46.8622"/>
<polygon fill="#000000" stroke="#000000" points="318.5001,-46.5817 315,-36.5817 311.5001,-46.5818 318.5001,-46.5817"/>
</g>
<!-- 6 -->
<g id="node10" class="node">
<title>6</title>
<polygon fill="none" stroke="#000000" points="360,-.5 360,-36.5 414,-36.5 414,-.5 360,-.5"/>
<text text-anchor="middle" x="387" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">6</text>
</g>
<!-- c_node&#45;&gt;6 -->
<g id="edge9" class="edge">
<title>c_node-&gt;6</title>
<path fill="none" stroke="#000000" d="M332.7978,-74.2079C341.6912,-65.0674 352.5958,-53.8599 362.2865,-43.9"/>
<polygon fill="#000000" stroke="#000000" points="364.9419,-46.1898 369.407,-36.5817 359.9248,-41.3083 364.9419,-46.1898"/>
</g>
<!-- 7 -->
<g id="node11" class="node">
<title>7</title>
<polygon fill="none" stroke="#000000" points="432,-.5 432,-36.5 486,-36.5 486,-.5 432,-.5"/>
<text text-anchor="middle" x="459" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">7</text>
</g>
<!-- d_node&#45;&gt;7 -->
<g id="edge10" class="edge">
<title>d_node-&gt;7</title>
<path fill="none" stroke="#000000" d="M486.1011,-74.2079C481.916,-65.6051 476.8401,-55.1713 472.2178,-45.6699"/>
<polygon fill="#000000" stroke="#000000" points="475.3186,-44.0429 467.7965,-36.5817 469.0239,-47.1052 475.3186,-44.0429"/>
</g>
<!-- 8 -->
<g id="node12" class="node">
<title>8</title>
<polygon fill="none" stroke="#000000" points="504,-.5 504,-36.5 558,-36.5 558,-.5 504,-.5"/>
<text text-anchor="middle" x="531" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">8</text>
</g>
<!-- d_node&#45;&gt;8 -->
<g id="edge11" class="edge">
<title>d_node-&gt;8</title>
<path fill="none" stroke="#000000" d="M503.8989,-74.2079C508.084,-65.6051 513.1599,-55.1713 517.7822,-45.6699"/>
<polygon fill="#000000" stroke="#000000" points="520.9761,-47.1052 522.2035,-36.5817 514.6814,-44.0429 520.9761,-47.1052"/>
</g>
<!-- 9 -->
<g id="node13" class="node">
<title>9</title>
<polygon fill="none" stroke="#000000" points="576,-.5 576,-36.5 630,-36.5 630,-.5 576,-.5"/>
<text text-anchor="middle" x="603" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">9</text>
</g>
<!-- d_node&#45;&gt;9 -->
<g id="edge12" class="edge">
<title>d_node-&gt;9</title>
<path fill="none" stroke="#000000" d="M521.4198,-74.3976C535.41,-64.8117 552.7764,-52.9125 567.8858,-42.5597"/>
<polygon fill="#000000" stroke="#000000" points="570.2077,-45.2116 576.4787,-36.672 566.251,-39.4371 570.2077,-45.2116"/>
</g>
</g>
</svg>

After

(image error) Size: 11 KiB

View file

@ -0,0 +1,206 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4
# New line preferences
end_of_line = lf
insert_final_newline = true
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
file_header_template = unset
# this. and Me. preferences
dotnet_style_qualification_for_event = false:silent
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_property = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
# Expression-level preferences
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
# Field preferences
dotnet_style_readonly_field = true:suggestion
# Parameter preferences
dotnet_code_quality_unused_parameters = all:suggestion
# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none
#### C# Coding Conventions ####
# var preferences
csharp_style_var_elsewhere = false:silent
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = false:silent
# Expression-bodied members
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_switch_expression = true:suggestion
# Null-checking preferences
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_prefer_static_local_function = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
# Code-block preferences
csharp_prefer_braces = true:silent
csharp_prefer_simple_using_statement = true:suggestion
# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
# 'using' directive preferences
csharp_using_directive_placement = inside_namespace:silent
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_anonymous_types = false
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_open_brace = none
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

View file

@ -0,0 +1,448 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# Ionide - VsCode extension for F# Support
.ionide/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# JetBrains Rider
.idea/
*.sln.iml
##
## Visual Studio Code
##
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

View file

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,66 @@
using System.Collections.Generic;
namespace graphs {
class BFS<T> where T : notnull {
private Graph<T> graph;
private Dictionary<T, int> Distance = new Dictionary<T, int>();
private Dictionary<T, T?> Parent = new Dictionary<T, T?>();
private Dictionary<T, Color> State = new Dictionary<T, Color>();
public BFS(Graph<T> graph) {
this.graph = graph;
}
public BFS<T> Run() {
foreach (var vertex in graph.Vertices) {
if (ColorOf(vertex) == Color.White) {
RunFrom(vertex);
}
}
return this;
}
public BFS<T> RunFrom(T start) {
State[start] = Color.Gray;
Distance[start] = 0;
Parent[start] = default(T);
var queue = new Queue<T>();
queue.Enqueue(start);
while (queue.Count > 0) {
var u = queue.Dequeue();
for (var iterator = graph.GetEdgesFrom(u); iterator.MoveNext();) {
var v = iterator.Current;
if (GetOrDefault(State, v, Color.White) == Color.White) {
State[v] = Color.Gray;
Distance[v] = Distance[u] + 1;
Parent[v] = u;
queue.Enqueue(v);
}
}
State[u] = Color.Black;
}
return this;
}
private static V GetOrDefault<U, V>(Dictionary<U, V> flags, U u, V defaultValue)
where U : notnull {
if (flags.TryGetValue(u, out var flag)) {
return flag;
}
return defaultValue;
}
public int DistanceTo(T u) => GetOrDefault(Distance, u, 0);
public T? ParentOf(T u) => GetOrDefault(Parent, u, default(T));
public Color ColorOf(T u) => GetOrDefault(State, u, Color.White);
}
}

View file

@ -0,0 +1,68 @@
using System.Collections.Generic;
namespace graphs {
class DFS<T> where T : notnull {
private Graph<T> graph;
private int time;
private Dictionary<T, int> Discovered = new Dictionary<T, int>();
private Dictionary<T, int> Finished = new Dictionary<T, int>();
private Dictionary<T, Color> State = new Dictionary<T, Color>();
public DFS(Graph<T> graph) {
this.graph = graph;
}
public DFS<T> Run() {
time = 0;
foreach (var vertex in graph.Vertices) {
if (ColorOf(vertex) == Color.White) {
RunFrom(vertex, false);
}
}
return this;
}
public DFS<T> RunFrom(T start, bool reset = true) {
var path = new Stack<(T, IEnumerator<T>)>();
if (reset) {
time = 0;
}
(Discovered[start], State[start]) = (++time, Color.Gray);
path.Push((start, graph.GetEdgesFrom(start)));
while (path.Count > 0) {
var (lastVertex, successors) = path.Peek();
if (!successors.MoveNext()) {
path.Pop();
(Finished[lastVertex], State[lastVertex]) = (++time, Color.Black);
} else if (ColorOf(successors.Current) == Color.White) {
var nextVertex = successors.Current;
(Discovered[nextVertex], State[nextVertex]) = (++time, Color.Gray);
path.Push((nextVertex, graph.GetEdgesFrom(nextVertex)));
}
}
return this;
}
private static V GetOrDefault<U, V>(Dictionary<U, V> flags, U u, V defaultValue)
where U : notnull
where V : notnull {
if (flags.TryGetValue(u, out var flag)) {
return flag;
}
return defaultValue;
}
public int DiscoveredAt(T u) => GetOrDefault(Discovered, u, 0);
public int FinishedAt(T u) => GetOrDefault(Finished, u, 0);
public Color ColorOf(T u) => GetOrDefault(State, u, Color.White);
}
}

View file

@ -0,0 +1,44 @@
using System.Collections.Generic;
using System.Linq;
namespace graphs {
enum Color {
White, Gray, Black
}
class Graph<T> where T : notnull {
private SortedSet<T> vertices = new SortedSet<T>();
private SortedDictionary<T, SortedSet<T>> edges = new SortedDictionary<T, SortedSet<T>>();
public SortedSet<T> Vertices {
get => vertices;
}
public void AddVertex(T u) {
vertices.Add(u);
edges.Add(u, new SortedSet<T>());
}
public void AddEdge(T u, T v) {
if (edges.TryGetValue(u, out var edgesFromU)) {
edgesFromU.Add(v);
}
}
public bool HasEdge(T u, T v) {
if (edges.TryGetValue(u, out var edgesFromU)) {
return edgesFromU.Contains(v);
}
return false;
}
public IEnumerator<T> GetEdgesFrom(T u) {
if (edges.TryGetValue(u, out var edgesFromU)) {
return edgesFromU.GetEnumerator();
}
return Enumerable.Empty<T>().GetEnumerator();
}
}
}

View file

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
namespace graphs {
class Program {
static Graph<string> CreateExampleGraph() {
var vertices = new List<string>() {
"s", "q", "t", "y", "r", "v", "w", "x", "z", "u"
};
var graph = new Graph<string>();
foreach (var vertex in vertices) {
graph.AddVertex(vertex);
}
graph.AddEdge("s", "v");
graph.AddEdge("q", "s");
graph.AddEdge("q", "w");
graph.AddEdge("q", "t");
graph.AddEdge("t", "y");
graph.AddEdge("t", "x");
graph.AddEdge("y", "q");
graph.AddEdge("r", "y");
graph.AddEdge("r", "u");
graph.AddEdge("v", "w");
graph.AddEdge("w", "s");
graph.AddEdge("x", "w");
graph.AddEdge("x", "z");
graph.AddEdge("z", "x");
graph.AddEdge("u", "y");
return graph;
}
static void Main(string[] args) {
var graph = CreateExampleGraph();
var dfsTraversal = new DFS<string>(graph).Run();
foreach (var vertex in graph.Vertices) {
Console.WriteLine($"{vertex}(d: {dfsTraversal.DiscoveredAt(vertex)}, f: {dfsTraversal.FinishedAt(vertex)})");
}
}
}
}

View file

@ -0,0 +1,139 @@
from hypothesis import given, settings
from hypothesis.strategies import integers, lists
import pytest
import itertools
def compare_by_value(pair):
"""
Takes a pair from enumerate in form: `index, value` and returns the value
Args:
pair (Tuple[int, T]): Index and element from the iterator at the index.
Returns:
Element from the pair.
"""
index, value = pair
return value
def maximum(arr, n):
"""
Finds index of maximum element of first n elements in list.
Args:
arr (List): List of values.
n (int): Upper bound of index where to search for maximum (inclusive).
Returns:
Index of a maximum element in `arr[:n]`.
"""
first_n_elements = itertools.islice(enumerate(arr), n)
index, value = max(first_n_elements, key=compare_by_value)
return index
# Precondition: n = |A|
# Loop invariant:
# A[i + 1 : n] is sorted AND
# all elements of A[i + 1 : n] are bigger or equal to the other elements
# Postcondition: A is sorted
def select_sort(arr, n):
"""
Sorts list `arr` using select sort algorithm.
Args:
arr (List): List of values.
n (int): Size of the list.
Returns:
Sorted list `arr`.
"""
assert n == len(arr)
check_loop_invariant(arr, n, n)
for i in reversed(range(1, n)):
j = maximum(arr, i + 1)
arr[i], arr[j] = arr[j], arr[i]
check_loop_invariant(arr, n, i)
return arr
def broken_select_sort(arr, n):
assert n == len(arr)
if not arr:
return
max_value = max(arr)
check_loop_invariant(arr, n, n)
for i in reversed(range(n)):
arr[i] = max_value + i
check_loop_invariant(arr, n, i)
return arr
def check_loop_invariant(arr, n, i):
# A[i + 1 : n] is sorted
for x, y in zip(itertools.islice(arr, i + 1, n), itertools.islice(arr, i + 2, n)):
assert x <= y
# all elements of A[i + 1 : n] are bigger or equal to the other elements
if i + 1 >= n:
# in case there are no elements
return
# otherwise, since the "tail" is sorted, we can assume that it is enough to
# check the other elements to the smallest value of the tail
smallest = arr[i + 1]
for element in itertools.islice(arr, i + 1):
assert smallest >= element
def check_vague_postcondition(original_arr, arr):
if not arr:
return
# check ordering
for x, y in zip(arr, itertools.islice(arr, 1, len(arr))):
assert x <= y
def check_postcondition(original_arr, arr):
if not arr:
return
# check ordering
for x, y in zip(arr, itertools.islice(arr, 1, len(arr))):
assert x <= y
# get counts from original list
original_counts = {}
for value in original_arr:
original_counts[value] = 1 + original_counts.get(value, 0)
# get counts from resulting list
counts = {}
for value in arr:
counts[value] = 1 + counts.get(value, 0)
# if arr is permutation of original_arr then all counts must be the same
assert counts == original_counts
@given(lists(integers()))
@settings(max_examples=1000)
@pytest.mark.parametrize(
"postcondition", [check_vague_postcondition, check_postcondition]
)
@pytest.mark.parametrize("sorting_function", [select_sort, broken_select_sort])
def test_select_sort(sorting_function, postcondition, numbers):
result = sorting_function(numbers[:], len(numbers))
postcondition(numbers, result)