{"action":"created","comment":{"url":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/comments/26903303","id":26903303,"diff_hunk":"@@ -0,0 +1,70 @@\n+(* Tasks 20-25\n+   Time: expectation 4h\n+         reality 6h\n+      Kuzmina Elizaveta *)\n+type IGraph =\n+  abstract member Size : int\n+  abstract member Vertices : int list \n+  abstract member Edge : int -> int -> bool\n+type Graph (v : int list, matrix : bool [,]) =\n+  interface IGraph with\n+    member this.Size = v.Length\n+    member this.Vertices = v \n+    member this.Edge v1 v2 = matrix.[v1, v2]\n+type GraphList (v : int list, list : (int list) list) =\n+  interface IGraph with\n+    member this.Size = v.Length\n+    member this.Vertices = v\n+    member this.Edge v1 v2 = (List.filter (fun x -> x = v2) list.[v1] <> [])\n+let AccessTo (graph : IGraph, v) =\n+  let arr = Array.create graph.Size false \n+  arr.[v] <- true\n+  let rec To x =\n+    for i in graph.Vertices do\n+      if (not arr.[i]) && (graph.Edge x i) then \n+        arr.[i] <- true\n+        To i \n+  To v\n+  arr.[v] <- false\n+  let mutable ver = []\n+  for i in graph.Vertices do\n+    if arr.[i] then ver <- i :: ver\n+  List.rev ver  \n+let AccessFrom (graph : IGraph, v) =\n+  let arr = Array.create graph.Size false \n+  arr.[v] <- true\n+  let rec From x =\n+    for i in graph.Vertices do\n+      if (not arr.[i]) && (graph.Edge i x) then \n+        arr.[i] <- true \n+        From i\n+  From v \n+  arr.[v] <- false\n+  let mutable ver = []\n+  for i in graph.Vertices do\n+    if arr.[i] then ver <- i :: ver \n+  List.rev ver                                                \n+type MarkedGr<'A> =\n+  inherit IGraph \n+  abstract member Value : int -> int -> 'A    \n+[<EntryPoint>]\n+let main args =\n+  printf \"С помощью матрицы: граф с тремя вершинфми и ребрами 0->1; 0->2; 1->2; 2->1\\n\"\n+  let ver = [0..2]\n+  let values = ['a'..'c']\n+  let matr = Array2D.create 3 3 false\n+  Array2D.set matr 0 1 true\n+  Array2D.set matr 0 2 true\n+  Array2D.set matr 1 2  true\n+  Array2D.set matr 2 1 true\n+  let NewGr1 = new Graph (ver, matr)\n+  printf \"Список вершин, доступных из 0: \"\n+  printf \"%A\\n\" (AccessTo (NewGr1, 0)) \n+  printf \"Список вершин, из которых можно попасть в 2: \"\n+  printf \"%A\\n\" (AccessFrom (NewGr1, 2))\n+  let s = [[1; 2]; [2]; [1]]\n+  let NewGr2 = new GraphList (ver, s)\n+  printf \"Тот же граф с помощью списка\\n\"\n+  printf \"Список вершин, доступных из 2: \"\n+  printf \"%A\\n\" (AccessTo (NewGr2, 2))","path":"tasks20.fs","position":69,"original_position":69,"commit_id":"1c736e0fed231a4c826167c086b51c881357a599","original_commit_id":"1c736e0fed231a4c826167c086b51c881357a599","user":{"login":"anlun","id":711192,"avatar_url":"https://avatars.githubusercontent.com/u/711192?v=3","gravatar_id":"","url":"https://api.github.com/users/anlun","html_url":"https://github.com/anlun","followers_url":"https://api.github.com/users/anlun/followers","following_url":"https://api.github.com/users/anlun/following{/other_user}","gists_url":"https://api.github.com/users/anlun/gists{/gist_id}","starred_url":"https://api.github.com/users/anlun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anlun/subscriptions","organizations_url":"https://api.github.com/users/anlun/orgs","repos_url":"https://api.github.com/users/anlun/repos","events_url":"https://api.github.com/users/anlun/events{/privacy}","received_events_url":"https://api.github.com/users/anlun/received_events","type":"User","site_admin":false},"body":"Пример слишком простой и неинтересный.","created_at":"2015-03-22T13:58:56Z","updated_at":"2015-03-22T13:58:56Z","html_url":"https://github.com/elizakuz/2nd-semester/pull/2#discussion_r26903303","pull_request_url":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/comments/26903303"},"html":{"href":"https://github.com/elizakuz/2nd-semester/pull/2#discussion_r26903303"},"pull_request":{"href":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/2","id":31682667,"html_url":"https://github.com/elizakuz/2nd-semester/pull/2","diff_url":"https://github.com/elizakuz/2nd-semester/pull/2.diff","patch_url":"https://github.com/elizakuz/2nd-semester/pull/2.patch","issue_url":"https://api.github.com/repos/elizakuz/2nd-semester/issues/2","number":2,"state":"open","locked":false,"title":"Hw03","user":{"login":"elizakuz","id":8983697,"avatar_url":"https://avatars.githubusercontent.com/u/8983697?v=3","gravatar_id":"","url":"https://api.github.com/users/elizakuz","html_url":"https://github.com/elizakuz","followers_url":"https://api.github.com/users/elizakuz/followers","following_url":"https://api.github.com/users/elizakuz/following{/other_user}","gists_url":"https://api.github.com/users/elizakuz/gists{/gist_id}","starred_url":"https://api.github.com/users/elizakuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elizakuz/subscriptions","organizations_url":"https://api.github.com/users/elizakuz/orgs","repos_url":"https://api.github.com/users/elizakuz/repos","events_url":"https://api.github.com/users/elizakuz/events{/privacy}","received_events_url":"https://api.github.com/users/elizakuz/received_events","type":"User","site_admin":false},"body":"hw03\r\n","created_at":"2015-03-22T04:06:30Z","updated_at":"2015-03-22T13:58:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"861108f5b1ad19759f19dc3778f77b072f096746","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/2/commits","review_comments_url":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/2/comments","review_comment_url":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elizakuz/2nd-semester/issues/2/comments","statuses_url":"https://api.github.com/repos/elizakuz/2nd-semester/statuses/1c736e0fed231a4c826167c086b51c881357a599","head":{"label":"elizakuz:hw03","ref":"hw03","sha":"1c736e0fed231a4c826167c086b51c881357a599","user":{"login":"elizakuz","id":8983697,"avatar_url":"https://avatars.githubusercontent.com/u/8983697?v=3","gravatar_id":"","url":"https://api.github.com/users/elizakuz","html_url":"https://github.com/elizakuz","followers_url":"https://api.github.com/users/elizakuz/followers","following_url":"https://api.github.com/users/elizakuz/following{/other_user}","gists_url":"https://api.github.com/users/elizakuz/gists{/gist_id}","starred_url":"https://api.github.com/users/elizakuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elizakuz/subscriptions","organizations_url":"https://api.github.com/users/elizakuz/orgs","repos_url":"https://api.github.com/users/elizakuz/repos","events_url":"https://api.github.com/users/elizakuz/events{/privacy}","received_events_url":"https://api.github.com/users/elizakuz/received_events","type":"User","site_admin":false},"repo":{"id":31088089,"name":"2nd-semester","full_name":"elizakuz/2nd-semester","owner":{"login":"elizakuz","id":8983697,"avatar_url":"https://avatars.githubusercontent.com/u/8983697?v=3","gravatar_id":"","url":"https://api.github.com/users/elizakuz","html_url":"https://github.com/elizakuz","followers_url":"https://api.github.com/users/elizakuz/followers","following_url":"https://api.github.com/users/elizakuz/following{/other_user}","gists_url":"https://api.github.com/users/elizakuz/gists{/gist_id}","starred_url":"https://api.github.com/users/elizakuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elizakuz/subscriptions","organizations_url":"https://api.github.com/users/elizakuz/orgs","repos_url":"https://api.github.com/users/elizakuz/repos","events_url":"https://api.github.com/users/elizakuz/events{/privacy}","received_events_url":"https://api.github.com/users/elizakuz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/elizakuz/2nd-semester","description":"F#","fork":false,"url":"https://api.github.com/repos/elizakuz/2nd-semester","forks_url":"https://api.github.com/repos/elizakuz/2nd-semester/forks","keys_url":"https://api.github.com/repos/elizakuz/2nd-semester/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elizakuz/2nd-semester/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elizakuz/2nd-semester/teams","hooks_url":"https://api.github.com/repos/elizakuz/2nd-semester/hooks","issue_events_url":"https://api.github.com/repos/elizakuz/2nd-semester/issues/events{/number}","events_url":"https://api.github.com/repos/elizakuz/2nd-semester/events","assignees_url":"https://api.github.com/repos/elizakuz/2nd-semester/assignees{/user}","branches_url":"https://api.github.com/repos/elizakuz/2nd-semester/branches{/branch}","tags_url":"https://api.github.com/repos/elizakuz/2nd-semester/tags","blobs_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/refs{/sha}","trees_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elizakuz/2nd-semester/statuses/{sha}","languages_url":"https://api.github.com/repos/elizakuz/2nd-semester/languages","stargazers_url":"https://api.github.com/repos/elizakuz/2nd-semester/stargazers","contributors_url":"https://api.github.com/repos/elizakuz/2nd-semester/contributors","subscribers_url":"https://api.github.com/repos/elizakuz/2nd-semester/subscribers","subscription_url":"https://api.github.com/repos/elizakuz/2nd-semester/subscription","commits_url":"https://api.github.com/repos/elizakuz/2nd-semester/commits{/sha}","git_commits_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/commits{/sha}","comments_url":"https://api.github.com/repos/elizakuz/2nd-semester/comments{/number}","issue_comment_url":"https://api.github.com/repos/elizakuz/2nd-semester/issues/comments{/number}","contents_url":"https://api.github.com/repos/elizakuz/2nd-semester/contents/{+path}","compare_url":"https://api.github.com/repos/elizakuz/2nd-semester/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elizakuz/2nd-semester/merges","archive_url":"https://api.github.com/repos/elizakuz/2nd-semester/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elizakuz/2nd-semester/downloads","issues_url":"https://api.github.com/repos/elizakuz/2nd-semester/issues{/number}","pulls_url":"https://api.github.com/repos/elizakuz/2nd-semester/pulls{/number}","milestones_url":"https://api.github.com/repos/elizakuz/2nd-semester/milestones{/number}","notifications_url":"https://api.github.com/repos/elizakuz/2nd-semester/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elizakuz/2nd-semester/labels{/name}","releases_url":"https://api.github.com/repos/elizakuz/2nd-semester/releases{/id}","created_at":"2015-02-20T22:24:16Z","updated_at":"2015-03-03T17:23:02Z","pushed_at":"2015-03-22T04:06:30Z","git_url":"git://github.com/elizakuz/2nd-semester.git","ssh_url":"git@github.com:elizakuz/2nd-semester.git","clone_url":"https://github.com/elizakuz/2nd-semester.git","svn_url":"https://github.com/elizakuz/2nd-semester","homepage":null,"size":200,"stargazers_count":0,"watchers_count":0,"language":"F#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"elizakuz:master","ref":"master","sha":"dcfe7a9432f84d4117d371282c2f89edda19313f","user":{"login":"elizakuz","id":8983697,"avatar_url":"https://avatars.githubusercontent.com/u/8983697?v=3","gravatar_id":"","url":"https://api.github.com/users/elizakuz","html_url":"https://github.com/elizakuz","followers_url":"https://api.github.com/users/elizakuz/followers","following_url":"https://api.github.com/users/elizakuz/following{/other_user}","gists_url":"https://api.github.com/users/elizakuz/gists{/gist_id}","starred_url":"https://api.github.com/users/elizakuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elizakuz/subscriptions","organizations_url":"https://api.github.com/users/elizakuz/orgs","repos_url":"https://api.github.com/users/elizakuz/repos","events_url":"https://api.github.com/users/elizakuz/events{/privacy}","received_events_url":"https://api.github.com/users/elizakuz/received_events","type":"User","site_admin":false},"repo":{"id":31088089,"name":"2nd-semester","full_name":"elizakuz/2nd-semester","owner":{"login":"elizakuz","id":8983697,"avatar_url":"https://avatars.githubusercontent.com/u/8983697?v=3","gravatar_id":"","url":"https://api.github.com/users/elizakuz","html_url":"https://github.com/elizakuz","followers_url":"https://api.github.com/users/elizakuz/followers","following_url":"https://api.github.com/users/elizakuz/following{/other_user}","gists_url":"https://api.github.com/users/elizakuz/gists{/gist_id}","starred_url":"https://api.github.com/users/elizakuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elizakuz/subscriptions","organizations_url":"https://api.github.com/users/elizakuz/orgs","repos_url":"https://api.github.com/users/elizakuz/repos","events_url":"https://api.github.com/users/elizakuz/events{/privacy}","received_events_url":"https://api.github.com/users/elizakuz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/elizakuz/2nd-semester","description":"F#","fork":false,"url":"https://api.github.com/repos/elizakuz/2nd-semester","forks_url":"https://api.github.com/repos/elizakuz/2nd-semester/forks","keys_url":"https://api.github.com/repos/elizakuz/2nd-semester/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elizakuz/2nd-semester/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elizakuz/2nd-semester/teams","hooks_url":"https://api.github.com/repos/elizakuz/2nd-semester/hooks","issue_events_url":"https://api.github.com/repos/elizakuz/2nd-semester/issues/events{/number}","events_url":"https://api.github.com/repos/elizakuz/2nd-semester/events","assignees_url":"https://api.github.com/repos/elizakuz/2nd-semester/assignees{/user}","branches_url":"https://api.github.com/repos/elizakuz/2nd-semester/branches{/branch}","tags_url":"https://api.github.com/repos/elizakuz/2nd-semester/tags","blobs_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/refs{/sha}","trees_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elizakuz/2nd-semester/statuses/{sha}","languages_url":"https://api.github.com/repos/elizakuz/2nd-semester/languages","stargazers_url":"https://api.github.com/repos/elizakuz/2nd-semester/stargazers","contributors_url":"https://api.github.com/repos/elizakuz/2nd-semester/contributors","subscribers_url":"https://api.github.com/repos/elizakuz/2nd-semester/subscribers","subscription_url":"https://api.github.com/repos/elizakuz/2nd-semester/subscription","commits_url":"https://api.github.com/repos/elizakuz/2nd-semester/commits{/sha}","git_commits_url":"https://api.github.com/repos/elizakuz/2nd-semester/git/commits{/sha}","comments_url":"https://api.github.com/repos/elizakuz/2nd-semester/comments{/number}","issue_comment_url":"https://api.github.com/repos/elizakuz/2nd-semester/issues/comments{/number}","contents_url":"https://api.github.com/repos/elizakuz/2nd-semester/contents/{+path}","compare_url":"https://api.github.com/repos/elizakuz/2nd-semester/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elizakuz/2nd-semester/merges","archive_url":"https://api.github.com/repos/elizakuz/2nd-semester/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elizakuz/2nd-semester/downloads","issues_url":"https://api.github.com/repos/elizakuz/2nd-semester/issues{/number}","pulls_url":"https://api.github.com/repos/elizakuz/2nd-semester/pulls{/number}","milestones_url":"https://api.github.com/repos/elizakuz/2nd-semester/milestones{/number}","notifications_url":"https://api.github.com/repos/elizakuz/2nd-semester/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elizakuz/2nd-semester/labels{/name}","releases_url":"https://api.github.com/repos/elizakuz/2nd-semester/releases{/id}","created_at":"2015-02-20T22:24:16Z","updated_at":"2015-03-03T17:23:02Z","pushed_at":"2015-03-22T04:06:30Z","git_url":"git://github.com/elizakuz/2nd-semester.git","ssh_url":"git@github.com:elizakuz/2nd-semester.git","clone_url":"https://github.com/elizakuz/2nd-semester.git","svn_url":"https://github.com/elizakuz/2nd-semester","homepage":null,"size":200,"stargazers_count":0,"watchers_count":0,"language":"F#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/2"},"html":{"href":"https://github.com/elizakuz/2nd-semester/pull/2"},"issue":{"href":"https://api.github.com/repos/elizakuz/2nd-semester/issues/2"},"comments":{"href":"https://api.github.com/repos/elizakuz/2nd-semester/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elizakuz/2nd-semester/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/elizakuz/2nd-semester/statuses/1c736e0fed231a4c826167c086b51c881357a599"}}}}