Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Converting fromto our JSONYaml representation of the plane graph
Synopsis
- toAdjRep :: PlanarGraph s w v e f -> Gr (Vtx v e) (Face f)
- fromAdjRep :: proxy s -> Gr (Vtx v e) (Face f) -> PlanarGraph s Primal v e f
- buildGraph :: proxy s -> Gr (Vtx v e) (Face f) -> PlanarGraph s Primal () () ()
- reorder :: Vector (i :+ a) -> (i -> Int) -> Vector a
- fromAdjacencyLists :: forall s w h. (Foldable h, Functor h) => [(VertexId s w, h (VertexId s w))] -> PlanarGraph s w () () ()
- assignArcs :: EdgeOracle s w e -> EdgeOracle s w (Int :+ e)
Documentation
toAdjRep :: PlanarGraph s w v e f -> Gr (Vtx v e) (Face f) Source #
Transforms the planar graph into a format taht can be easily converted into JSON format. For every vertex, the adjacent vertices are given in counter clockwise order.
See toAdjacencyLists
for notes on how we handle self-loops.
running time: \(O(n)\)
fromAdjRep :: proxy s -> Gr (Vtx v e) (Face f) -> PlanarGraph s Primal v e f Source #
Read a planar graph, given in JSON format into a planar graph. The adjacencylists should be in counter clockwise order.
running time: \(O(n)\)
buildGraph :: proxy s -> Gr (Vtx v e) (Face f) -> PlanarGraph s Primal () () () Source #
Builds the graph from the adjacency lists (but ignores all associated data)
fromAdjacencyLists :: forall s w h. (Foldable h, Functor h) => [(VertexId s w, h (VertexId s w))] -> PlanarGraph s w () () () Source #
Construct a planar graph from a adjacency matrix. For every vertex, all vertices should be given in counter clockwise order.
pre: No self-loops, and no multi-edges
running time: \(O(n)\).
assignArcs :: EdgeOracle s w e -> EdgeOracle s w (Int :+ e) Source #
Orphan instances
(ToJSON v, ToJSON e, ToJSON f) => ToJSON (PlanarGraph s w v e f) Source # | |
toJSON :: PlanarGraph s w v e f -> Value # toEncoding :: PlanarGraph s w v e f -> Encoding # toJSONList :: [PlanarGraph s w v e f] -> Value # toEncodingList :: [PlanarGraph s w v e f] -> Encoding # | |
(FromJSON v, FromJSON e, FromJSON f) => FromJSON (PlanarGraph s Primal v e f) Source # | |
parseJSON :: Value -> Parser (PlanarGraph s Primal v e f) # parseJSONList :: Value -> Parser [PlanarGraph s Primal v e f] # |