Diff for ''
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| <includeonly><div class="thumb {{#switch: {{{align|}}} | left = tleft | center | centre = tnone | tright}} {{#if: {{{noclear|}}} | no-clear }}" style="width:{{#ifeq: {{{direction|horizontal}}} | vertical | {{#expr: {{#if: {{{width|}}} | {{{width}}} | {{{width1}}} }} + 12}} | {{#if: {{{width|}}} | {{#expr: 8 + ({{{width|0}}} + 4) * {{#if: {{{image5|}}} | 5 | {{#if: {{{image4|}}} | 4 | {{#if: {{{image3|}}} | 3 | 2 }} }} }} }} | {{#expr: 16 + {{{width1}}} + {{{width2}}} + {{{width3|0}}} + {{{width4|0}}} + {{{width5|0}}} + {{#if: {{{image5|}}} | 12 | {{#if: {{{image4|}}} | 8 | {{#if: {{{image3|}}} | 4 | 0 }} }} }} }} }} }}px;{{#switch: {{{align|}}} | center | centre = margin: 0 auto;}}"> <div class="thumbinner"> {{#if: {{{header|}}} | <div style="clear:both;font-weight:bold;text-align:{{{header_align|center}}};background:{{{header_background|transparent}}};">{{{header}}}</div> }} <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width1}}} }} }}px;"><div class="thumbimage">[[Image:{{{image1}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width1}}} }}px|{{{caption1|{{{box_caption}}}}}}]]</div>{{#if: {{{caption1|}}} | <div class="thumbcaption" style="clear:left;">{{{caption1}}}</div>}}</div> <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width2}}} }} }}px;"><div class="thumbimage">[[Image:{{{image2}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width2}}} }}px|{{{caption2|{{{box_caption}}}}}}]]</div>{{#if: {{{caption2|}}} | <div class="thumbcaption" style="clear:left;">{{{caption2}}}</div>}}</div> {{#if: {{{image3|}}} | <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width3}}} }} }}px;"><div class="thumbimage">[[Image:{{{image3}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width3}}} }}px|{{{caption3|{{{box_caption}}}}}}]]</div>{{#if: {{{caption3|}}} | <div class="thumbcaption" style="clear:left;">{{{caption3}}}</div>}}</div> {{#if: {{{image4|}}} | <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width4}}} }} }}px;"><div class="thumbimage">[[Image:{{{image4}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width4}}} }}px|{{{caption4|{{{box_caption}}}}}}]]</div>{{#if: {{{caption4|}}} | <div class="thumbcaption" style="clear:left;">{{{caption4}}}</div>}}</div> {{#if: {{{image5|}}} | <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width5}}} }} }}px;"><div class="thumbimage">[[Image:{{{image5}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width5}}} }}px|{{{caption5|{{{box_caption}}}}}}]]</div>{{#if: {{{caption5|}}} | <div class="thumbcaption" style="clear:left;">{{{caption5}}}</div>}}</div>}}}}}} {{#if: {{{footer|}}} | <div class="thumbcaption" style="clear:left;text-align:{{{footer_align|left}}};background:{{{footer_background|transparent}}};">{{{footer}}}</div> }}</div></div></includeonly><noinclude> {{documentation}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> </noinclude> |
# Příklad do prologu <{ForumPost(poster="wweennddeell", timestamp=2010-06-28 22:20:08)}> Dobrý den, potřeboval bych pomoct naprogramovat úlohu v prologu. Hledal jsem nějaké řešení na internetu, ale nic jsem nenašel a absolutně si s tím nevím rady. Úloha zní takto: Na vstupu je zadán graf, který obecně není stromem. Napište program v jazyce Prolog, který vytiskne pro zadaný uzel grafu všechny cykly grafu, jichž je daný uzel prvkem. Budu rád za každou Vaši pomoc... <{/ForumPost}> <{ForumPost(poster="H8me", timestamp=2010-06-29 17:12:28)}> Zdarec, co to to ? Je to pre orientovany graf. %graf je zoznam hran v tvare h(X,Y) vsetkyCykly(Hrany,X,Out):-findall(C,(cyklus(Hrany,X,X,[],C),length(C,Len),Len > 1),Out). cyklus(_,X,X,Akum,Akum). cyklus(Hrany,X,Y,Akum,Out):-member(h(Y,N),Hrany), not(member(N,Akum)), cyklus(Hrany,X,N,[N|Akum],Out). <{/ForumPost}> <{ForumPost(poster="wweennddeell", timestamp=2010-06-29 23:05:55)}> Díky moc za snahu. Ten prolog je pro mě kámen úrazu. Jestli sem to dobře pochopil, tak mám například tyto hrany: h(b,c). h(f,c). h(g,h). h(d). h(f,b). h(k,f). h(h,g). Co mám teda napsat za vstupní podmínku, aby mi prolog vypsal všechny cykly třeba uzlu f (i když v tomhle příkladu je pouze jeden cyklus). Řešení sem našel na téhle stránce: [https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/](https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/) .Příklad P82 by měl být přesně ten, co hledám, bohužel vůbec nevím jak ten program mám z toho sestavit. <{/ForumPost}> <{ForumPost(poster="H8me", timestamp=2010-06-29 23:25:14)}> Neviem co ma vyjadrovat h(d) ale ked to preskocim tak dotaz pre tvoj priklad by vyzeral takto: vsetkyCykly(\[h(f,c),h(g,h),h(f,b),h(k,f),h(h,g)],f,Out). Out je volna premenna, ta vrati zoznam cyklov. A to riesenie co si postol funguje na tom istom principe, tiez vyhladava cesty v grafe zo zaciatkom aj koncom v tom istom bode. <{/ForumPost}> <{ForumPost(poster="Andrew24", timestamp=2015-01-12 13:58:54)}> Mohl by mi prosím někdo poradit jak by to vypadalo kdyby se měly na konci vypsat všechny cykly jichž daný uzel **neni** prvkem? díky <{/ForumPost}> |