Documentation
¶
Overview ¶
Package standard_graph provides a standard implementation of a graph data structure.
Index ¶
- func BarabasiAlbertGraph(n int, m int, isUndirected bool) *graph.Graph
- func ErdosRenyiGraph(n int, p float64, isUndirected bool) *graph.Graph
- func RandomGeometricGraph(n int, r float64, isUndirected bool) *graph.Graph
- func RandomRegularGraph(n, k int, isUndirected bool) *graph.Graph
- func SetSeed(value int64)
- func SetSeedRandom()
- func WattsStrogatzGraph(n, k int, beta float64, isUndirected bool) *graph.Graph
- func WaxmanGraph(n int, alpha, beta float64, isUndirected bool) *graph.Graph
- type STANDARD_GRAPH_TYPE
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BarabasiAlbertGraph ¶
BarabasiAlbertGraph generates a graph based on the Barabási–Albert preferential attachment model.
func ErdosRenyiGraph ¶
ErdosRenyiGraph generates a random graph based on the Erdős-Rényi model.
func RandomGeometricGraph ¶
RandomGeometricGraph generates a random geometric graph (RGG). n = number of nodes r = connection radius (0~1) isUndirected = undirected or directed graph
func RandomRegularGraph ¶
RandomRegularGraph generates a random k-regular graph with n nodes. Each node has exactly degree k. Returns nil if impossible.
func SetSeedRandom ¶
func SetSeedRandom()
SetSeedRandom sets the seed to a random value for non-deterministic behavior.
func WattsStrogatzGraph ¶
WattsStrogatzGraph generates a Watts–Strogatz small-world graph. n = number of nodes k = each node is connected to k nearest neighbors in ring (must be even) beta = rewiring probability (0 = regular lattice, 1 = random graph)
Types ¶
type STANDARD_GRAPH_TYPE ¶
type STANDARD_GRAPH_TYPE int
STANDARD_GRAPH_TYPE defines types of standard graphs.
const ( ERDOS_RENYI STANDARD_GRAPH_TYPE = iota RANDOM_REGULAR BARABASI_ALBERT WATTS_STROGATZ RANDOM_GEOMETRIC WAXMAN )
func (STANDARD_GRAPH_TYPE) String ¶
func (s STANDARD_GRAPH_TYPE) String(onlyAlphabet bool) string
String returns the string representation of the STANDARD_GRAPH_TYPE.