math-grads-0.1.6.7: Library containing graph data structures and graph algorithms

Safe HaskellSafe
LanguageHaskell2010

Math.Grads.Algo.Interaction

Contents

Description

Module that provides various functions for interaction with GraphEdges, EdgeLists and vertices themselves.

Synopsis

Vertex Functions

areAdjacent :: EdgeList e -> Int -> Int -> Bool Source #

Checks whether two vertices with given indices are adjacent in given EdgeList.

getEnds :: GraphEdge e -> [Int] Source #

Retrieves indices of vertices that are being connected by given GraphEdge.

getOtherEnd :: GraphEdge e -> Int -> Int Source #

Returns index of vertex incident to given GraphEdge and different from passed index.

getSharedVertex :: GraphEdge e1 -> GraphEdge e2 -> Maybe Int Source #

Gets shared common vertex of two edges. If edges don't have common vertex, returns Nothing.

getVertexAdjacent :: EdgeList e -> Int -> [Int] Source #

Finds in given EdgeList all indices of vertices adjacent to given vertex.

getVertexIncident :: EdgeList e -> Int -> EdgeList e Source #

Find all edges in given EdgeList that are incident to vertex with given index.

getVertexIncidentIdx :: EdgeList e -> Int -> [Int] Source #

Returns indices of edges in EdgeList that are incident to vertex with given index.

haveSharedVertex :: GraphEdge e1 -> GraphEdge e2 -> Bool Source #

Checks that two edges have common vertex.

isIncident :: GraphEdge e -> Int -> Bool Source #

Checks that vertex with given index is incident to GraphEdge.

(~=) :: GraphEdge e1 -> GraphEdge e2 -> Bool Source #

Equality operator for GraphEdges.

(/~=) :: GraphEdge e1 -> GraphEdge e2 -> Bool Source #

Inequality operator for GraphEdges.

Edge Functions

matchEdges :: EdgeList e -> [(Int, Int)] -> EdgeList e Source #

Find edges in EdgeList which ordered pairs of indices, that they are connecting, are present in passed list of ordered pairs.

getEdgeIncident :: Ord e => EdgeList e -> Int -> EdgeList e Source #

Find all edges that are incident to edge in EdgeList with given index.

EdgeList Functions

doubleEdgeList :: EdgeList e -> EdgeList e Source #

For every edge in EdgeList add to that list an edge in opposite direction.

edgeListToMap :: EdgeList e -> Map Int [Int] Source #

Transforms EdgeList into Map that corresponds to adjacency list of undirected graph induced by these edges.

haveSharedEdge :: Eq e => EdgeList e -> EdgeList e -> Bool Source #

Checks that two EdgeLists have common edge.

sortBondList :: Ord e => EdgeList e -> EdgeList e Source #

Sorting for EdgeList, that sorts edges on their type, then on index of their to (right) vertex, then on index of their from (left) vertex.

getIndices :: EdgeList e -> [Int] Source #

Gets all vertices from EdgeList.