libgraph 1.6 → 1.7
raw patch · 3 files changed
+24/−17 lines, 3 files
Files
- Data/Graph/Libgraph/AlgoDebug.hs +10/−10
- Data/Graph/Libgraph/Dot.hs +13/−6
- libgraph.cabal +1/−1
Data/Graph/Libgraph/AlgoDebug.hs view
@@ -16,15 +16,15 @@ next_step :: Eq v => Graph v a -> (v -> Judgement) -> v -> v-next_step tree j v = case j v of- Unassessed -> v- Right -> case preds tree v of- [] -> v- (w:_) -> next_step tree j w- Wrong -> case filter (\w -> j w == Unassessed) (succs tree v) of- [] -> v- (w:_) -> w--+next_step tree j v + | j v == Wrong || v == root tree =+ case filter (\w -> j w == Unassessed) (succs tree v) of+ [] -> v+ (w:_) -> w + | j v == Right =+ case preds tree v of+ [] -> v+ (w:_) -> next_step tree j w + | j v == Unassessed = v
Data/Graph/Libgraph/Dot.hs view
@@ -11,7 +11,7 @@ -> (Arc vertex arc->String) -> String showWith g vLabel aLabel = "diGraph G {\n"- ++ vName r ++ "[shape=none label=\".\"]\n"+ -- ++ vName r ++ "[shape=none label=\".\"]\n" ++ foldl (\s v -> show1 v ++ s) "" vs ++ foldl (\s a -> (showArc vs aLabel a) ++ s) "" (arcs g) ++ "}\n"@@ -20,7 +20,7 @@ isRoot (v,_) = v == root g show1 v- | isRoot v = vName r ++ "[shape=none label=\".\"]\n"+ -- | isRoot v = vName r ++ "[shape=none label=\".\"]\n" | otherwise = (showVertex vLabel v) showVertex :: (vertex->(String,String)) -> (vertex,Int) -> String@@ -39,10 +39,17 @@ vName i = "v" ++ show i escape :: String -> String-escape [] = []-escape ('"' : ss) = '\\' : '"' : escape ss-escape ('\\' : ss) = '\\' : '\\' : escape ss-escape (s : ss) = s : escape ss+escape [] = []+escape ss = escape' False ss++escape' _ [] = []+escape' _ ('"' : ss) = '\\' : '"' : escape' False ss+escape' _ ('\\' : ss) = '\\' : '\\' : escape' False ss+escape' w (s : ss)+ | w && (s == ' ' || s == '\n') = escape' True ss+ | (not w) && (s == ' ' || s == '\n') = ' ' : escape' True ss+ | otherwise = s : escape' False ss+ -- | Invoke Graphviz and Imagemagick to display graph on screen. display :: (Graph vertex arc -> String) -> Graph vertex arc -> IO ()
libgraph.cabal view
@@ -1,5 +1,5 @@ Name: libgraph -Version: 1.6 +Version: 1.7 Homepage: http://maartenfaddegon.nl Synopsis: Store and manipulate data in a graph. Description: A graph type, analysis of graphs and manipulation of graphs.