Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
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.
- completeGraph :: Int -> GraphInfo
- completeGraphWithSelfloops :: Int -> GraphInfo
- completeBipartiteGraph :: Int -> Int -> GraphInfo
- emptyGraph :: Int -> GraphInfo
- barbellGraph :: Int -> Int -> GraphInfo
- generalizedBarbellGraph :: Int -> Int -> Int -> GraphInfo
- cycleGraph :: Int -> GraphInfo
- pathGraph :: Int -> GraphInfo
- starGraph :: Int -> GraphInfo
- wheelGraph :: Int -> GraphInfo
- grid2DGraph :: Int -> Int -> GraphInfo
Documentation
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
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
:: 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
:: 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
:: 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
Generate the cycle graph of size n.
Edges are created from lower node IDs to higher node IDs.
Precondition (not checked): n >= 0
Generate the path graph of size n, consisting of n nodes that are interconnected in a single path.
Precondition (not checked): n >= 0
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
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
Generate the 2D grid graph of dimensions m*n
Algorithm courtesy