standard_graph

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package standard_graph provides a standard implementation of a graph data structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BarabasiAlbertGraph

func BarabasiAlbertGraph(n int, m int, isUndirected bool) *graph.Graph

BarabasiAlbertGraph generates a graph based on the Barabási–Albert preferential attachment model.

func ErdosRenyiGraph

func ErdosRenyiGraph(n int, p float64, isUndirected bool) *graph.Graph

ErdosRenyiGraph generates a random graph based on the Erdős-Rényi model.

func RandomGeometricGraph

func RandomGeometricGraph(n int, r float64, isUndirected bool) *graph.Graph

RandomGeometricGraph generates a random geometric graph (RGG). n = number of nodes r = connection radius (0~1) isUndirected = undirected or directed graph

func RandomRegularGraph

func RandomRegularGraph(n, k int, isUndirected bool) *graph.Graph

RandomRegularGraph generates a random k-regular graph with n nodes. Each node has exactly degree k. Returns nil if impossible.

func SetSeed

func SetSeed(value int64)

SetSeed sets the seed for random operations in the graph.

func SetSeedRandom

func SetSeedRandom()

SetSeedRandom sets the seed to a random value for non-deterministic behavior.

func WattsStrogatzGraph

func WattsStrogatzGraph(n, k int, beta float64, isUndirected bool) *graph.Graph

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)

func WaxmanGraph

func WaxmanGraph(n int, alpha, beta float64, isUndirected bool) *graph.Graph

WaxmanGraph generates a Waxman random graph. n = number of nodes alpha, beta = Waxman parameters (0<alpha<=1, 0<beta<=1) isUndirected = undirected or directed 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL