summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2012-06-17 23:06:10 +1000
committerJed Barber <jjbarber@y7mail.com>2012-06-17 23:06:10 +1000
commit47f5dc7af82316e846fa2285bcfddca09fea9664 (patch)
tree11da1f5fd1aceb7d536953753ac901165afe8074
parentbd7d6db4cee36a3535f8de97c1c0642e1b31106b (diff)
Switched to fgl graph implementation
-rw-r--r--ProofGraph.hs48
1 files changed, 0 insertions, 48 deletions
diff --git a/ProofGraph.hs b/ProofGraph.hs
deleted file mode 100644
index 780f3ed..0000000
--- a/ProofGraph.hs
+++ /dev/null
@@ -1,48 +0,0 @@
-module ProofGraph (
- Node(..),
- Graph(..),
-
- empty,
- insert,
- delete,
- union
- ) where
-
-import Data.Set( Set )
-import qualified Data.Set as Set
-import qualified Data.List as List
-
-
-
-data Node a = Node { contents :: a
- , successors :: Set (Node a) } deriving (Eq, Ord)
-
-data Graph a = Graph { nodes :: Set (Node a) }
-
-
-
-instance (Show a, Eq a) => Show (Node a) where
- show x = let header = show . contents $ x
- footer = if ((successors x) == Set.empty)
- then "\n"
- else " -> " ++ List.intercalate ", " (map (show . contents) (Set.toList . successors $ x)) ++ "\n"
- in header ++ footer
-
-instance (Show a, Eq a) => Show (Graph a) where
- show x = "Graph: \n" ++ List.foldl' (++) [] (map show (Set.toList . nodes $ x)) ++ "\n"
-
-
-empty :: Graph a
-empty = Graph Set.empty
-
-
-insert :: Ord a => Node a -> Graph a -> Graph a
-insert node graph = Graph (Set.insert node (nodes graph))
-
-
-delete :: Ord a => Node a -> Graph a -> Graph a
-delete node graph = Graph (Set.delete node (nodes graph))
-
-
-union :: Ord a => Set (Node a) -> Graph a -> Graph a
-union nodeSet graph = Graph (Set.union nodeSet (nodes graph))