[{"name":"Graph","comment":"\n\n\n# Construction\n\n@docs Graph, Edge, empty, fromVerticesAndEdges\n\n\n# Modification\n\n@docs addVertex, removeVertex, updateVertex, addEdge, removeEdge, map, reverseEdges\n\n\n# Predicates\n\n@docs isEmpty, hasVertex, hasEdge, areAdjacent\n\n\n# Querying\n\n@docs fold, size, vertices, edges, verticesAndEdges, outgoingEdges, edgeToComparable\n\n","unions":[{"name":"Graph","comment":" A directed graph data structure.\n\n**The vertices** can hold any data, but you can't have two vertices holding the same data. (Think of it as of `Set`.)\n\n**The edges** don't hold any data, they just connect two vertices. Again, they are **directed:** the order does matter.\n\n","args":["vertex"],"cases":[]}],"aliases":[{"name":"Edge","comment":" A representation of an edge between two vertices.\n","args":["vertex"],"type":"{ from : vertex, to : vertex }"}],"values":[{"name":"addEdge","comment":" Add an edge to the graph.\n\nIf any of the vertices aren't present yet, this function **will add them** before\nadding the edge.\n\nDirected: the order of the vertices does matter.\n\n    Graph.empty\n        |> Graph.addEdge \"foo\" \"bar\"\n        |> Graph.vertices\n    --> [ \"foo\", \"bar\" ]\n\n    Graph.empty\n        |> Graph.addEdge \"foo\" \"bar\"\n        |> Graph.edges\n    --> [ { from = \"foo\", to = \"bar\" } ]\n\n","type":"vertex -> vertex -> Graph.Graph vertex -> Graph.Graph vertex"},{"name":"addVertex","comment":" Add the vertex to the graph. (Nothing happens if it's already present.)\n\nBy default it's not connected to any other vertex.\n\n    Graph.empty\n        |> Graph.addVertex \"foo\"\n        |> Graph.vertices\n    --> [ \"foo\" ]\n\n","type":"vertex -> Graph.Graph vertex -> Graph.Graph vertex"},{"name":"areAdjacent","comment":" Does the graph contain an edge between these two vertices (in any direction)?\n\n    Graph.empty\n        |> Graph.areAdjacent \"x\" \"y\"\n    --> False\n\n    Graph.empty\n        |> Graph.addEdge \"x\" \"y\"\n        |> Graph.areAdjacent \"x\" \"y\"\n    --> True\n\n    Graph.empty\n        |> Graph.addEdge \"y\" \"x\"\n        |> Graph.areAdjacent \"x\" \"y\"\n    --> True\n\n","type":"vertex -> vertex -> Graph.Graph vertex -> Basics.Bool"},{"name":"edgeToComparable","comment":" Transform the record into a `(from, to)` tuple.\n\n    Graph.edgeToComparable { from = \"foo\", to = \"bar\" }\n    --> (\"foo\", \"bar\")\n\n","type":"Graph.Edge comparable -> ( comparable, comparable )"},{"name":"edges","comment":" Return a list of the edges. Don't expect any sensible order - it's\nimplementation defined.\n\n    Graph.empty\n        |> Graph.addEdge \"foo\" \"bar\"\n        |> Graph.addEdge \"bar\" \"quux\"\n        |> Graph.edges\n    --> [ { from = \"bar\", to = \"quux\" }\n        , { from = \"foo\", to = \"bar\" }\n        ]\n\n","type":"Graph.Graph vertex -> List.List (Graph.Edge vertex)"},{"name":"empty","comment":" An empty graph. No vertices, no edges.\n","type":"Graph.Graph vertex"},{"name":"fold","comment":" Fold a function over all the vertices, starting with the \"oldest\" vertices.\n\n    Graph.empty\n        |> Graph.addVertex \"foo\"\n        |> Graph.addVertex \"bar\"\n        |> Graph.fold (\\v acc -> acc ++ v) \"\"\n    --> \"foobar\"\n\n","type":"(vertex -> acc -> acc) -> acc -> Graph.Graph vertex -> acc"},{"name":"fromVerticesAndEdges","comment":" Construct a graph from a list of vertices and a list of edges.\n\nImplicitly adds vertices that are present in the edges list, as if they were mentioned in the vertices list too.\n\n    Graph.fromVerticesAndEdges\n        [ \"x\", \"y\" ]\n        [ { from = \"x\", to = \"y\" }\n        , { from = \"y\", to = \"z\" }\n        , { from = \"z\", to = \"x\" }\n        ]\n        |> Graph.vertices\n        |> List.length\n    --> 3\n\n","type":"List.List vertex -> List.List (Graph.Edge vertex) -> Graph.Graph vertex"},{"name":"hasEdge","comment":" Is this edge present in the graph?\n\n    Graph.empty\n        |> Graph.hasEdge {from = \"x\", to = \"y\"}\n    --> False\n\n    Graph.empty\n        |> Graph.addEdge \"x\" \"y\"\n        |> Graph.hasEdge {from = \"x\", to = \"y\"}\n    --> True\n\n    Graph.empty\n        |> Graph.addEdge \"y\" \"x\"\n        |> Graph.hasEdge {from = \"x\", to = \"y\"}\n    --> False\n\n","type":"Graph.Edge vertex -> Graph.Graph vertex -> Basics.Bool"},{"name":"hasVertex","comment":" Is this vertex present in the graph?\n\n    Graph.empty\n        |> Graph.hasVertex \"x\"\n    --> False\n\n    Graph.empty\n        |> Graph.addVertex \"x\"\n        |> Graph.hasVertex \"x\"\n    --> True\n\n","type":"vertex -> Graph.Graph vertex -> Basics.Bool"},{"name":"isEmpty","comment":" Is the graph empty?\n","type":"Graph.Graph vertex -> Basics.Bool"},{"name":"map","comment":" Applies a function to all the vertices.\n\n    Graph.empty\n        |> Graph.addVertex \"foo\"\n        |> Graph.addVertex \"bar\"\n        |> Graph.map String.toUpper\n        |> Graph.vertices\n    --> [ \"FOO\", \"BAR\" ]\n\n","type":"(vertex -> vertex2) -> Graph.Graph vertex -> Graph.Graph vertex2"},{"name":"outgoingEdges","comment":" Lists all vertices this vertex has edges to.\n\nDirected - only lists the edges that go _from_ the given vertex.\n\n     Graph.empty\n         |> Graph.outgoingEdges \"foo\"\n     --> []\n\n     Graph.empty\n         |> Graph.addEdge \"foo\" \"bar\"\n         |> Graph.addEdge \"foo\" \"baz\"\n         |> Graph.addEdge \"quux\" \"foo\"\n         |> Graph.outgoingEdges \"foo\"\n     --> [ \"bar\", \"baz\" ]\n\n","type":"vertex -> Graph.Graph vertex -> List.List vertex"},{"name":"removeEdge","comment":" Remove an edge from the first vertex to the second one. Does nothing if the\nedge is not present.\n\nDirected: the order of the vertices does matter.\n\n    Graph.empty\n        |> Graph.addEdge \"foo\" \"bar\"\n        |> Graph.removeEdge \"foo\" \"bar\"\n        |> Graph.edges\n    --> []\n\n","type":"vertex -> vertex -> Graph.Graph vertex -> Graph.Graph vertex"},{"name":"removeVertex","comment":" Remove the vertex from the graph. (Nothing happens if it's not present.)\n\n    Graph.empty\n        |> Graph.addVertex \"foo\"\n        |> Graph.removeVertex \"foo\"\n        |> Graph.isEmpty\n    --> True\n\n","type":"vertex -> Graph.Graph vertex -> Graph.Graph vertex"},{"name":"reverseEdges","comment":" Reverse the direction of all the edges in the graph.\n\n    Graph.empty\n        |> Graph.addEdge \"foo\" \"bar\"\n        |> Graph.reverseEdges\n        |> Graph.edges\n    --> [ { from = \"bar\", to = \"foo\" } ]\n\n","type":"Graph.Graph vertex -> Graph.Graph vertex"},{"name":"size","comment":" Determine the number of vertices in the graph.\n\n    Graph.size Graph.empty\n    --> 0\n\n    Graph.empty\n        |> Graph.addVertex \"foo\"\n        |> Graph.addVertex \"bar\"\n        |> Graph.size\n    --> 2\n\n","type":"Graph.Graph vertex -> Basics.Int"},{"name":"updateVertex","comment":" Updates the vertex data. Does nothing if the vertex is not present.\n\n    Graph.empty\n        |> Graph.addVertex \"foo\"\n        |> Graph.updateVertex \"foo\" String.toUpper\n        |> Graph.vertices\n    --> [ \"FOO\" ]\n\n","type":"vertex -> (vertex -> vertex) -> Graph.Graph vertex -> Graph.Graph vertex"},{"name":"vertices","comment":" Return a list of the vertices, starting with the \"oldest\".\n\n    Graph.empty\n        |> Graph.addVertex \"foo\"\n        |> Graph.addVertex \"bar\"\n        |> Graph.vertices\n    --> [ \"foo\", \"bar\" ]\n\n","type":"Graph.Graph vertex -> List.List vertex"},{"name":"verticesAndEdges","comment":" Return a record with a list of vertices and list of edges in the graph.\n\n    Graph.empty\n        |> Graph.addVertex \"foo\"\n        |> Graph.addEdge \"foo\" \"bar\"\n        |> Graph.verticesAndEdges\n    --> { vertices = [ \"foo\", \"bar\" ]\n        , edges = [ { from = \"foo\", to = \"bar\" } ]\n        }\n\n","type":"Graph.Graph vertex -> { vertices : List.List vertex, edges : List.List (Graph.Edge vertex) }"}],"binops":[]}]