[{"name":"Data.Graph","comment":" An Elm graph type implementation, inspired by Haskell's Data.Graph.\n\nReference: <https://hackage.haskell.org/package/containers-0.7/docs/src/Data.Graph.html>\n\nThis implementation attempts to adapt the concepts and structure from the\nHaskell Graph into the Elm ecosystem.\n\n\n# Graphs\n\n@docs Graph, Bounds, Edge, Vertex, Table\n\n\n# Graph Construction\n\n@docs graphFromEdges, graphFromEdges_, buildG\n\n\n# Graph Properties\n\n@docs vertices, edges, outdegree, indegree\n\n\n# Graph Transformations\n\n@docs transposeG\n\n\n# Graph Algorithms\n\n@docs dfs, dff, scc\n\n\n# Strongly Connected Components\n\n@docs SCC\n\n\n## Construction\n\n@docs stronglyConnComp, stronglyConnCompR\n\n\n## Conversion\n\n@docs flattenSCC, flattenSCCs\n\n\n## Array\n\n@docs Array\n\n","unions":[{"name":"SCC","comment":" Strongly connected component.\n","args":["vertex"],"cases":[["AcyclicSCC",["vertex"]],["CyclicSCC",["List.List vertex"]]]}],"aliases":[{"name":"Array","comment":" Array structure\n","args":["i","e"],"type":"Data.Graph.Internal.Array i e"},{"name":"Bounds","comment":" The bounds of an @Array@.\n","args":[],"type":"( Data.Graph.Vertex, Data.Graph.Vertex )"},{"name":"Edge","comment":" An edge from the first vertex to the second.\n","args":[],"type":"( Data.Graph.Vertex, Data.Graph.Vertex )"},{"name":"Graph","comment":" Adjacency list representation of a graph, mapping each vertex to its\nlist of successors.\n","args":[],"type":"Data.Graph.Array Data.Graph.Vertex (List.List Data.Graph.Vertex)"},{"name":"Table","comment":" Table indexed by a contiguous set of vertices.\n","args":["a"],"type":"Data.Graph.Array Data.Graph.Vertex a"},{"name":"Vertex","comment":" Abstract representation of vertices.\n","args":[],"type":"Basics.Int"}],"values":[{"name":"buildG","comment":" (O(V+E)). Build a graph from a list of edges.\n\nWarning: This function will cause a runtime exception if a vertex in the edge\nlist is not within the given @Bounds@.\n\n==== **Examples**\n\n> buildG (0,-1) [] == array (0,-1) []\n> buildG (0,2) [(0,1), (1,2)] == array (0,2) [(0,[1]),(1,[2]),(2,[])]\n> buildG (0,2) [(0,1), (0,2), (1,2)] == array (0,2) [(0,[2,1]),(1,[2]),(2,[])]\n\n","type":"Data.Graph.Bounds -> List.List Data.Graph.Edge -> Data.Graph.Graph"},{"name":"dff","comment":" (O(V+E)). A spanning forest of the graph, obtained from a depth-first\nsearch of the graph starting from each vertex in an unspecified order.\n","type":"Data.Graph.Graph -> List.List (Tree.Tree Data.Graph.Vertex)"},{"name":"dfs","comment":" (O(V+E)). A spanning forest of the part of the graph reachable from the\nlisted vertices, obtained from a depth-first search of the graph starting at\neach of the listed vertices in order.\n\nThis function deviates from King and Launchbury's implementation by\nbundling together the functions generate, prune, and chop for efficiency\nreasons.\n\n","type":"Data.Graph.Graph -> List.List Data.Graph.Vertex -> List.List (Tree.Tree Data.Graph.Vertex)"},{"name":"edges","comment":" (O(V+E)). Returns the list of edges in the graph.\n\n==== **Examples**\n\n> edges (buildG (0,-1) []) == []\n\n> edges (buildG (0,2) [(0,1),(1,2)]) == [(0,1),(1,2)]\n\n","type":"Data.Graph.Graph -> List.List Data.Graph.Edge"},{"name":"flattenSCC","comment":" The vertices of a strongly connected component.\n","type":"Data.Graph.SCC vertex -> List.List vertex"},{"name":"flattenSCCs","comment":" The vertices of a list of strongly connected components.\n","type":"List.List (Data.Graph.SCC a) -> List.List a"},{"name":"graphFromEdges","comment":" (O((V+E) \\\\log V)). Build a graph from a list of nodes uniquely identified\nby keys, with a list of keys of nodes this node should have edges to.\n\nThis function takes an adjacency list representing a graph with vertices of\ntype @key@ labeled by values of type @node@ and produces a @Graph@-based\nrepresentation of that list. The @Graph@ result represents the /shape/ of the\ngraph, and the functions describe a) how to retrieve the label and adjacent\nvertices of a given vertex, and b) how to retrieve a vertex given a key.\n\n@(graph, nodeFromVertex, vertexFromKey) = graphFromEdges edgeList@\n\n  - @graph :: Graph@ is the raw, array based adjacency list for the graph.\n  - @nodeFromVertex :: Vertex -> (node, key, [key])@ returns the node\n    associated with the given 0-based @Int@ vertex; see /warning/ below. This\n    runs in (O(1)) time.\n  - @vertexFromKey :: key -> Maybe Vertex@ returns the @Int@ vertex for the\n    key if it exists in the graph, @Nothing@ otherwise. This runs in\n    (O(\\\\log V)) time.\n\nTo safely use this API you must either extract the list of vertices directly\nfrom the graph or first call @vertexFromKey k@ to check if a vertex\ncorresponds to the key @k@. Once it is known that a vertex exists you can use\n@nodeFromVertex@ to access the labelled node and adjacent vertices. See below\nfor examples.\n\nNote: The out-list may contain keys that don't correspond to nodes of the\ngraph; they are ignored.\n\nWarning: The @nodeFromVertex@ function will cause a runtime exception if the\ngiven @Vertex@ does not exist.\n\n==== **Examples**\n\nAn empty graph.\n\n> (graph, nodeFromVertex, vertexFromKey) = graphFromEdges []\n> graph = array (0,-1) []\n\nA graph where the out-list references unspecified nodes (@'c'@), these are\nignored.\n\n> (graph, _, _) = graphFromEdges [(\"a\", 'a', ['b']), (\"b\", 'b', ['c'])]\n> array (0,1) [(0,[1]),(1,[])]\n\nA graph with 3 vertices: (\"a\") -> (\"b\") -> (\"c\")\n\n> (graph, nodeFromVertex, vertexFromKey) = graphFromEdges [(\"a\", 'a', ['b']), (\"b\", 'b', ['c']), (\"c\", 'c', [])]\n> graph == array (0,2) [(0,[1]),(1,[2]),(2,[])]\n> nodeFromVertex 0 == Just (\"a\",'a',['b'])\n> vertexFromKey 'a' == Just 0\n\nGet the label for a given key.\n\n> let getNodePart (n, _, _) = n\n> (graph, nodeFromVertex, vertexFromKey) = graphFromEdges [(\"a\", 'a', ['b']), (\"b\", 'b', ['c']), (\"c\", 'c', [])]\n> Maybe.andThen (Maybe.map getNodePart << nodeFromVertex) (vertexFromKey 'a') == Just \"A\"\n\n","type":"List.List ( node, comparable, List.List comparable ) -> ( Data.Graph.Graph, Data.Graph.Vertex -> Maybe.Maybe ( node, comparable, List.List comparable ), comparable -> Maybe.Maybe Data.Graph.Vertex )"},{"name":"graphFromEdges_","comment":" (O((V+E) \\\\log V)). Identical to 'graphFromEdges', except that the return\nvalue does not include the function which maps keys to vertices. This\nversion of 'graphFromEdges' is for backwards compatibility.\n","type":"List.List ( node, comparable, List.List comparable ) -> ( Data.Graph.Graph, Data.Graph.Vertex -> Maybe.Maybe ( node, comparable, List.List comparable ) )"},{"name":"indegree","comment":" (O(V+E)). A table of the count of edges into each node.\n\n==== **Examples**\n\n> indegree (buildG (0,-1) []) == array (0,-1) []\n\n> indegree (buildG (0,2) [(0,1), (1,2)]) == array (0,2) [(0,0),(1,1),(2,1)]\n\n","type":"Data.Graph.Graph -> Data.Graph.Array Data.Graph.Vertex Basics.Int"},{"name":"outdegree","comment":" (O(V+E)). A table of the count of edges from each node.\n\n==== **Examples**\n\n> outdegree (buildG (0,-1) []) == array (0,-1) []\n\n> outdegree (buildG (0,2) [(0,1), (1,2)]) == array (0,2) [(0,1),(1,1),(2,0)]\n\n","type":"Data.Graph.Graph -> Data.Graph.Array Data.Graph.Vertex Basics.Int"},{"name":"scc","comment":" The strongly connected components of a graph, in reverse topological order.\n\n    scc (buildG ( 0, 3 ) [ ( 3, 1 ), ( 1, 2 ), ( 2, 0 ), ( 0, 1 ) ])\n        == [ Tree.tree 0 [ Tree.tree 1 [ Tree.tree 2 [] ] ]\n           , Tree.tree 3 []\n           ]\n\n","type":"Data.Graph.Graph -> List.List (Tree.Tree Data.Graph.Vertex)"},{"name":"stronglyConnComp","comment":" The strongly connected components of a directed graph,\nreverse topologically sorted.\n\n    stronglyConnComp [ ( \"a\", 0, [ 1 ] ), ( \"b\", 1, [ 2, 3 ] ), ( \"c\", 2, [ 1 ] ), ( \"d\", 3, [ 3 ] ) ]\n        == [ CyclicSCC [ \"d\" ], CyclicSCC [ \"b\", \"c\" ], AcyclicSCC \"a\" ]\n\n","type":"List.List ( node, comparable, List.List comparable ) -> List.List (Data.Graph.SCC node)"},{"name":"stronglyConnCompR","comment":" The strongly connected components of a directed graph,\nreverse topologically sorted. The function is the same as\n'stronglyConnComp', except that all the information about each node retained.\nThis interface is used when you expect to apply 'SCC' to\n(some of) the result of 'SCC', so you don't want to lose the\ndependency information.\n\n    stronglyConnCompR [ ( \"a\", 0, [ 1 ] ), ( \"b\", 1, [ 2, 3 ] ), ( \"c\", 2, [ 1 ] ), ( \"d\", 3, [ 3 ] ) ]\n        == [ CyclicSCC [ ( \"d\", 3, [ 3 ] ) ], CyclicSCC [ ( \"b\", 1, [ 2, 3 ] ), ( \"c\", 2, [ 1 ] ) ], AcyclicSCC ( \"a\", 0, [ 1 ] ) ]\n\n","type":"List.List ( node, comparable, List.List comparable ) -> List.List (Data.Graph.SCC ( node, comparable, List.List comparable ))"},{"name":"transposeG","comment":" (O(V+E)). The graph obtained by reversing all edges.\n\n==== **Examples**\n\n> transposeG (buildG (0,2) [(0,1), (1,2)]) == array (0,2) [(0,[]),(1,[0]),(2,[1])]\n\n","type":"Data.Graph.Graph -> Data.Graph.Graph"},{"name":"vertices","comment":" (O(V)). Returns the list of vertices in the graph.\n\n==== **Examples**\n\n> vertices (buildG (0,-1) []) == []\n\n> vertices (buildG (0,2) [(0,1),(1,2)]) == [0,1,2]\n\n","type":"Data.Graph.Graph -> List.List Data.Graph.Vertex"}],"binops":[]}]