graph-generators-0.1.2.1: Functions for generating structured or random FGL graphs

Safe HaskellSafe
LanguageHaskell2010

Data.Graph.Generators.Regular

Description

Graph generators for simple parametric, regular graphs.

Built using NetworkX 1.8.1, see NetworkX Generators

graph-generators copyright: Copyright (C) 2014 Uli Köhler Apache License v2.0

NetworkX copyright: Copyright (C) 2004-2010 by Aric Hagberg hagberg@lanl.gov Dan Schult dschult@colgate.edu Pieter Swart swart@lanl.gov All rights reserved. BSD license.

Synopsis

Documentation

completeGraph Source

Arguments

:: Int

The number of nodes in the graph

-> GraphInfo

The resulting complete graph

Generate a completely connected graph with n nodes.

The generated graph contains node labels [0..n-1]

In contrast to completeGraphWithSelfloops this function does not generate self-loops.

Contains only one edge between two connected nodes, use undir to make it quasi-undirected. The generated edge (i,j) satisfied i < j.

Precondition (not checked): n >= 0

completeGraphWithSelfloops Source

Arguments

:: Int

The number of nodes in the graph

-> GraphInfo

The resulting complete graph

Variant of completeGraph generating self-loops.

All generated edges (i,j) satisfy i <= j.

See completeGraph for a more detailed behaviour description.

Precondition (not checked): n >= 0

completeBipartiteGraph Source

Arguments

:: Int

The number of nodes in the first partition

-> Int

The number of nodes in the second partition

-> GraphInfo

The resulting graph

Generate the complete bipartite graph with n1 nodes in the first partition and n2 nodes in the second partition.

Each node in the first partition is connected to each node in the second partition.

The first partition nodes are identified by [0..n1-1] while the nodes in the second partition are identified by [n1..n1+n2-1]

Use undir to also add edges from the second partition to the first partition.

Precondition (not checked): n >= 0

emptyGraph :: Int -> GraphInfo Source

Generates the empty graph with n nodes and zero edges.

The nodes are labelled [0..n-1]

Precondition (not checked): n >= 0

barbellGraph Source

Arguments

:: Int

The number of nodes in the complete bells

-> Int

The number of nodes in the path, i.e the number of nodes outside the bells

-> GraphInfo

The resulting barbell graph

Generate the barbell graph, consisting of two complete subgraphs connected by a single path.

In contrast to generalizedBarbellGraph, this function always generates identically-sized bells. Therefore this is a special case of generalizedBarbellGraph

Precondition (not checked): n >= 0

generalizedBarbellGraph Source

Arguments

:: Int

The number of nodes in the first bell

-> Int

The number of nodes in the path, i.e. the number of nodes outside the bells

-> Int

The number of nodes in the second bell

-> GraphInfo

The resulting barbell graph

Generate the barbell graph, consisting of two complete subgraphs connected by a single path.

Self-loops are not generated.

The nodes in the first bell are identified by [0..n1-1] The nodes in the path are identified by [n1..n1+np-1] The nodes in the second bell are identified by [n1+np..n1+np+n2-1]

Precondition (not checked): n >= 0

cycleGraph Source

Arguments

:: Int

n: Number of nodes in the circle

-> GraphInfo

The circular graph with n nodes.

Generate the cycle graph of size n.

Edges are created from lower node IDs to higher node IDs.

Precondition (not checked): n >= 0

pathGraph Source

Arguments

:: Int

n: Number of nodes

-> GraphInfo 

Generate the path graph of size n, consisting of n nodes that are interconnected in a single path.

Precondition (not checked): n >= 0

starGraph Source

Arguments

:: Int

n: Number of overall nodes

-> GraphInfo 

Generate the star graph with n nodes: One central node (ID 0) connected to n-1 outer nodes, having no interconnections themselves

Precondition (not checked): n >= 0

wheelGraph Source

Arguments

:: Int

n: Number of overall nodes

-> GraphInfo 

Generate the wheel graph with n nodes: One central node (ID 0) connected to n-1 outer nodes building a cycle graph.

Precondition (not checked): n >= 0

grid2DGraph Source

Arguments

:: Int

m: Number of rows in the grid

-> Int

n: Number of columns in the grid

-> GraphInfo 

Generate the 2D grid graph of dimensions m*n

Algorithm courtesy