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

Safe HaskellNone
LanguageHaskell2010

Data.Graph.Generators.Random.BarabasiAlbert

Contents

Synopsis

Graph generators

barabasiAlbertGraph Source

Arguments

:: GenIO

The random number generator to use

-> Int

The overall number of nodes (n)

-> Int

The number of edges to create between a new and existing nodes (m)

-> IO GraphInfo

The resulting graph (IO required for randomness)

barabasiAlbertGraph' Source

Arguments

:: Int

The number of nodes

-> Int

The number of edges to create between a new and existing nodes (m)

-> IO GraphInfo

The resulting graph (IO required for randomness)

Utility functions

selectNth :: Int -> [(Int, Int)] -> Int Source

Select the nth element from a multiset occur list, treating it as virtual large list This is significantly faster than building up the entire list and selecting the nth element

selectRandomElement :: GenIO -> (IntMultiSet, Int) -> IO Int Source

Select a single random element from the multiset, with precalculated size Note that the given size must be the total multiset size, not the number of distinct elements in said se

selectNDistinctRandomElements :: GenIO -> Int -> (IntMultiSet, Int) -> IO [Int] Source

Select n distinct random elements from a multiset, with This function will fail to terminate if there are less than n distinct elements in the multiset. This function accepts a multiset with precomputed size for performance reasons