Module
Data.Graph
- Package
- purescript-colehaus-graphs
- Repository
- colehaus/purescript-graphs
A data structure and functions for graphs
#insertEdge Source
insertEdge :: forall v k. Ord k => k -> k -> Graph k v -> Graph k v
Insert an edge from the start key to the end key.
#insertVertex Source
insertVertex :: forall v k. Ord k => k -> v -> Graph k v -> Graph k v
Insert a vertex into the graph.
If the key already exists, replaces the existing value and preserves existing edges.
#descendants Source
descendants :: forall v k. Ord k => k -> Graph k v -> Set k
Returns all descendants of given key.
Will return bottom if k
is in cycle.
#topologicalSort Source
topologicalSort :: forall v k. Ord k => Graph k v -> List k
Topologically sort the vertices of a graph.
If the graph contains cycles, then the behavior is undefined.
#isAdjacent Source
isAdjacent :: forall v k. Ord k => k -> k -> Graph k v -> Boolean
Check if the first key is adjacent to the second.
#areConnected Source
areConnected :: forall v k. Ord k => k -> k -> Graph k v -> Boolean
Checks if there's a directed path between the start and end key.
- Modules
- Data.
Graph