Documentation
¶
Overview ¶
Package standard_graph provides a standard implementation of a graph data structure.
Index ¶
- type STANDARD_GRAPH_TYPE
- type StandardGraph
- func (sg *StandardGraph) BarabasiAlbertGraph(n int, m int, isUndirected bool) *graph.Graph
- func (sg *StandardGraph) ErdosRenyiGraph(n int, p float64, isUndirected bool) *graph.Graph
- func (sg *StandardGraph) RandomGeometricGraph(n int, r float64, isUndirected bool) *graph.Graph
- func (sg *StandardGraph) RandomRegularGraph(n, k int, isUndirected bool) *graph.Graph
- func (g *StandardGraph) SetSeed(value int64)
- func (g *StandardGraph) SetSeedRandom()
- func (sg *StandardGraph) WattsStrogatzGraph(n, k int, beta float64, isUndirected bool) *graph.Graph
- func (sg *StandardGraph) WaxmanGraph(n int, alpha, beta float64, isUndirected bool) *graph.Graph
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
BarabasiAlbertGraph generates a graph based on the Barabási–Albert preferential attachment model.
func (*StandardGraph) ErdosRenyiGraph ¶ added in v0.8.2
ErdosRenyiGraph generates a random graph based on the Erdős-Rényi model.
func (*StandardGraph) RandomGeometricGraph ¶ added in v0.8.2
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
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
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