standard_graph

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 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

This section is empty.

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.

type StandardGraph added in v0.8.2

type StandardGraph struct {
	// contains filtered or unexported fields
}

func NewStandardGraph added in v0.8.2

func NewStandardGraph() *StandardGraph

func (*StandardGraph) BarabasiAlbertGraph added in v0.8.2

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

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

func (*StandardGraph) ErdosRenyiGraph added in v0.8.2

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

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

func (*StandardGraph) RandomGeometricGraph added in v0.8.2

func (sg *StandardGraph) 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 (*StandardGraph) RandomRegularGraph added in v0.8.2

func (sg *StandardGraph) 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 (*StandardGraph) SetSeed added in v0.8.2

func (g *StandardGraph) SetSeed(value int64)

SetSeed sets the seed for random operations in the graph.

func (*StandardGraph) SetSeedRandom added in v0.8.2

func (g *StandardGraph) SetSeedRandom()

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

func (*StandardGraph) WattsStrogatzGraph added in v0.8.2

func (sg *StandardGraph) 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 (*StandardGraph) WaxmanGraph added in v0.8.2

func (sg *StandardGraph) 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

Jump to

Keyboard shortcuts

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