{"action":"created","comment":{"url":"https://api.github.com/repos/gonum/graph/pulls/comments/32368563","id":32368563,"diff_hunk":"@@ -4,193 +4,166 @@\n \n package graph\n \n-// All a node needs to do is identify itself. This allows the user to pass in nodes more\n-// interesting than an int, but also allow us to reap the benefits of having a map-storable,\n-// comparable type.\n+import \"math\"\n+\n+// Node is a graph node. It returns a graph-unique integer ID.\n type Node interface {\n \tID() int\n }\n \n-// Allows edges to do something more interesting that just be a group of nodes. While the methods\n-// are called From and To, they are not considered directed unless the given interface specifies\n-// otherwise.\n+// Edge is a graph edge. In directed graphs, the direction of the\n+// edge is given from -> to, otherwise the edge is semantically\n+// unordered.\n type Edge interface {\n \tFrom() Node\n \tTo() Node\n }\n \n-// A Graph implements the behavior of an undirected graph.\n-//\n-// All methods in Graph are implicitly undirected. Graph algorithms that care about directionality\n-// will intelligently choose the DirectedGraph behavior if that interface is also implemented,\n-// even if the function itself only takes in a Graph (or a super-interface of graph).\n+// Graph is a generalized graph.\n type Graph interface {\n-\t// NodeExists returns true when node is currently in the graph.\n-\tNodeExists(Node) bool\n-\n-\t// NodeList returns a list of all nodes in no particular order, useful for\n-\t// determining things like if a graph is fully connected. The caller is\n-\t// free to modify this list. Implementations should construct a new list\n-\t// and not return internal representation.\n-\tNodeList() []Node\n-\n-\t// Neighbors returns all nodes connected by any edge to this node.\n-\tNeighbors(Node) []Node\n-\n-\t// EdgeBetween returns an edge between node and neighbor such that\n-\t// From is one argument and To is the other. If no\n-\t// such edge exists, this function returns nil.\n-\tEdgeBetween(node, neighbor Node) Edge\n-}\n+\t// Has returns whether the node exists within the graph.\n+\tHas(Node) bool\n \n-// Directed graphs are characterized by having seperable Heads and Tails in their edges.\n-// That is, if node1 goes to node2, that does not necessarily imply that node2 goes to node1.\n-//\n-// While it's possible for a directed graph to have fully reciprocal edges (i.e. the graph is\n-// symmetric) -- it is not required to be. The graph is also required to implement Graph\n-// because in many cases it can be useful to know all neighbors regardless of direction.\n-type DirectedGraph interface {\n-\tGraph\n-\t// Successors gives the nodes connected by OUTBOUND edges.\n-\t// If the graph is an undirected graph, this set is equal to Predecessors.\n-\tSuccessors(Node) []Node\n-\n-\t// EdgeTo returns an edge between node and successor such that\n-\t// From returns node and To returns successor, if no\n-\t// such edge exists, this function returns nil.\n-\tEdgeTo(node, successor Node) Edge\n-\n-\t// Predecessors gives the nodes connected by INBOUND edges.\n-\t// If the graph is an undirected graph, this set is equal to Successors.\n-\tPredecessors(Node) []Node\n-}\n+\t// Nodes returns all the nodes in the graph.\n+\tNodes() []Node\n \n-// Returns all undirected edges in the graph\n-type EdgeLister interface {\n-\tEdgeList() []Edge\n-}\n+\t// From returns all nodes that can be reached from","path":"graph.go","position":80,"original_position":80,"commit_id":"491ccd39a9378c1aa6190c902b60a2b9a17c93fc","original_commit_id":"491ccd39a9378c1aa6190c902b60a2b9a17c93fc","user":{"login":"kortschak","id":275221,"avatar_url":"https://avatars.githubusercontent.com/u/275221?v=3","gravatar_id":"","url":"https://api.github.com/users/kortschak","html_url":"https://github.com/kortschak","followers_url":"https://api.github.com/users/kortschak/followers","following_url":"https://api.github.com/users/kortschak/following{/other_user}","gists_url":"https://api.github.com/users/kortschak/gists{/gist_id}","starred_url":"https://api.github.com/users/kortschak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kortschak/subscriptions","organizations_url":"https://api.github.com/users/kortschak/orgs","repos_url":"https://api.github.com/users/kortschak/repos","events_url":"https://api.github.com/users/kortschak/events{/privacy}","received_events_url":"https://api.github.com/users/kortschak/received_events","type":"User","site_admin":false},"body":"If the node is not in the graph, there are no reachable nodes, so it returns a zero length slice.\r\n\r\nI'm not sure I understand the first comment. Does it return a non-nil slice? It probably should not, but it doesn't really make any difference except for performance (minor at that).","created_at":"2015-06-13T06:57:40Z","updated_at":"2015-06-13T06:57:40Z","html_url":"https://github.com/gonum/graph/pull/85#discussion_r32368563","pull_request_url":"https://api.github.com/repos/gonum/graph/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/gonum/graph/pulls/comments/32368563"},"html":{"href":"https://github.com/gonum/graph/pull/85#discussion_r32368563"},"pull_request":{"href":"https://api.github.com/repos/gonum/graph/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/gonum/graph/pulls/85","id":37517803,"html_url":"https://github.com/gonum/graph/pull/85","diff_url":"https://github.com/gonum/graph/pull/85.diff","patch_url":"https://github.com/gonum/graph/pull/85.patch","issue_url":"https://api.github.com/repos/gonum/graph/issues/85","number":85,"state":"open","locked":false,"title":"all: api redesign","user":{"login":"kortschak","id":275221,"avatar_url":"https://avatars.githubusercontent.com/u/275221?v=3","gravatar_id":"","url":"https://api.github.com/users/kortschak","html_url":"https://github.com/kortschak","followers_url":"https://api.github.com/users/kortschak/followers","following_url":"https://api.github.com/users/kortschak/following{/other_user}","gists_url":"https://api.github.com/users/kortschak/gists{/gist_id}","starred_url":"https://api.github.com/users/kortschak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kortschak/subscriptions","organizations_url":"https://api.github.com/users/kortschak/orgs","repos_url":"https://api.github.com/users/kortschak/repos","events_url":"https://api.github.com/users/kortschak/events{/privacy}","received_events_url":"https://api.github.com/users/kortschak/received_events","type":"User","site_admin":false},"body":"~~For review comments: if the comment relates to a specific line, please comment on the commit rather than in the PR so that I can see which commit touched the file - I want to keep changes systematic to allow future bisection, so I'll make amendments by interactive rebase.~~\r\n\r\nOther comments in the conversation tab.\r\n\r\nOngoing review is welcomed.\r\n\r\n@gonum/developers @vladimir-ch \r\n\r\nTODO(kortschak): Go through commits and amend \"Fixes/Updates issue #...\" lines when everything is OK prior to submission.","created_at":"2015-06-11T23:01:17Z","updated_at":"2015-06-13T06:57:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7d06aee44e2923d3fce548c028477d96866872ca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gonum/graph/pulls/85/commits","review_comments_url":"https://api.github.com/repos/gonum/graph/pulls/85/comments","review_comment_url":"https://api.github.com/repos/gonum/graph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gonum/graph/issues/85/comments","statuses_url":"https://api.github.com/repos/gonum/graph/statuses/491ccd39a9378c1aa6190c902b60a2b9a17c93fc","head":{"label":"gonum:colour-and-movement","ref":"colour-and-movement","sha":"491ccd39a9378c1aa6190c902b60a2b9a17c93fc","user":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"repo":{"id":8589420,"name":"graph","full_name":"gonum/graph","owner":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gonum/graph","description":"Graph packages for the Go language","fork":false,"url":"https://api.github.com/repos/gonum/graph","forks_url":"https://api.github.com/repos/gonum/graph/forks","keys_url":"https://api.github.com/repos/gonum/graph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gonum/graph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gonum/graph/teams","hooks_url":"https://api.github.com/repos/gonum/graph/hooks","issue_events_url":"https://api.github.com/repos/gonum/graph/issues/events{/number}","events_url":"https://api.github.com/repos/gonum/graph/events","assignees_url":"https://api.github.com/repos/gonum/graph/assignees{/user}","branches_url":"https://api.github.com/repos/gonum/graph/branches{/branch}","tags_url":"https://api.github.com/repos/gonum/graph/tags","blobs_url":"https://api.github.com/repos/gonum/graph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gonum/graph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gonum/graph/git/refs{/sha}","trees_url":"https://api.github.com/repos/gonum/graph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gonum/graph/statuses/{sha}","languages_url":"https://api.github.com/repos/gonum/graph/languages","stargazers_url":"https://api.github.com/repos/gonum/graph/stargazers","contributors_url":"https://api.github.com/repos/gonum/graph/contributors","subscribers_url":"https://api.github.com/repos/gonum/graph/subscribers","subscription_url":"https://api.github.com/repos/gonum/graph/subscription","commits_url":"https://api.github.com/repos/gonum/graph/commits{/sha}","git_commits_url":"https://api.github.com/repos/gonum/graph/git/commits{/sha}","comments_url":"https://api.github.com/repos/gonum/graph/comments{/number}","issue_comment_url":"https://api.github.com/repos/gonum/graph/issues/comments{/number}","contents_url":"https://api.github.com/repos/gonum/graph/contents/{+path}","compare_url":"https://api.github.com/repos/gonum/graph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gonum/graph/merges","archive_url":"https://api.github.com/repos/gonum/graph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gonum/graph/downloads","issues_url":"https://api.github.com/repos/gonum/graph/issues{/number}","pulls_url":"https://api.github.com/repos/gonum/graph/pulls{/number}","milestones_url":"https://api.github.com/repos/gonum/graph/milestones{/number}","notifications_url":"https://api.github.com/repos/gonum/graph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gonum/graph/labels{/name}","releases_url":"https://api.github.com/repos/gonum/graph/releases{/id}","created_at":"2013-03-05T21:22:45Z","updated_at":"2015-06-11T20:44:30Z","pushed_at":"2015-06-12T09:40:32Z","git_url":"git://github.com/gonum/graph.git","ssh_url":"git@github.com:gonum/graph.git","clone_url":"https://github.com/gonum/graph.git","svn_url":"https://github.com/gonum/graph","homepage":"","size":3147,"stargazers_count":69,"watchers_count":69,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":21,"forks":8,"open_issues":21,"watchers":69,"default_branch":"master"}},"base":{"label":"gonum:master","ref":"master","sha":"c36721b7c438e12c048d8d4a4f05be272d2cddf4","user":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"repo":{"id":8589420,"name":"graph","full_name":"gonum/graph","owner":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gonum/graph","description":"Graph packages for the Go language","fork":false,"url":"https://api.github.com/repos/gonum/graph","forks_url":"https://api.github.com/repos/gonum/graph/forks","keys_url":"https://api.github.com/repos/gonum/graph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gonum/graph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gonum/graph/teams","hooks_url":"https://api.github.com/repos/gonum/graph/hooks","issue_events_url":"https://api.github.com/repos/gonum/graph/issues/events{/number}","events_url":"https://api.github.com/repos/gonum/graph/events","assignees_url":"https://api.github.com/repos/gonum/graph/assignees{/user}","branches_url":"https://api.github.com/repos/gonum/graph/branches{/branch}","tags_url":"https://api.github.com/repos/gonum/graph/tags","blobs_url":"https://api.github.com/repos/gonum/graph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gonum/graph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gonum/graph/git/refs{/sha}","trees_url":"https://api.github.com/repos/gonum/graph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gonum/graph/statuses/{sha}","languages_url":"https://api.github.com/repos/gonum/graph/languages","stargazers_url":"https://api.github.com/repos/gonum/graph/stargazers","contributors_url":"https://api.github.com/repos/gonum/graph/contributors","subscribers_url":"https://api.github.com/repos/gonum/graph/subscribers","subscription_url":"https://api.github.com/repos/gonum/graph/subscription","commits_url":"https://api.github.com/repos/gonum/graph/commits{/sha}","git_commits_url":"https://api.github.com/repos/gonum/graph/git/commits{/sha}","comments_url":"https://api.github.com/repos/gonum/graph/comments{/number}","issue_comment_url":"https://api.github.com/repos/gonum/graph/issues/comments{/number}","contents_url":"https://api.github.com/repos/gonum/graph/contents/{+path}","compare_url":"https://api.github.com/repos/gonum/graph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gonum/graph/merges","archive_url":"https://api.github.com/repos/gonum/graph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gonum/graph/downloads","issues_url":"https://api.github.com/repos/gonum/graph/issues{/number}","pulls_url":"https://api.github.com/repos/gonum/graph/pulls{/number}","milestones_url":"https://api.github.com/repos/gonum/graph/milestones{/number}","notifications_url":"https://api.github.com/repos/gonum/graph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gonum/graph/labels{/name}","releases_url":"https://api.github.com/repos/gonum/graph/releases{/id}","created_at":"2013-03-05T21:22:45Z","updated_at":"2015-06-11T20:44:30Z","pushed_at":"2015-06-12T09:40:32Z","git_url":"git://github.com/gonum/graph.git","ssh_url":"git@github.com:gonum/graph.git","clone_url":"https://github.com/gonum/graph.git","svn_url":"https://github.com/gonum/graph","homepage":"","size":3147,"stargazers_count":69,"watchers_count":69,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":21,"forks":8,"open_issues":21,"watchers":69,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gonum/graph/pulls/85"},"html":{"href":"https://github.com/gonum/graph/pull/85"},"issue":{"href":"https://api.github.com/repos/gonum/graph/issues/85"},"comments":{"href":"https://api.github.com/repos/gonum/graph/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/gonum/graph/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/gonum/graph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gonum/graph/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/gonum/graph/statuses/491ccd39a9378c1aa6190c902b60a2b9a17c93fc"}}}}