graph

package
v0.0.0-...-7fd8b9d Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	Source *Vertex
	Target *Vertex
	Weight int
}

Edge represents an edge in the graph

type Graph

type Graph struct {
	Vertices []*Vertex
}

Graph represents a graph data structure

func InitializeGraph

func InitializeGraph() *Graph

InitializeGraph initializes a graph

func (*Graph) AddEdge

func (g *Graph) AddEdge(source, target *Vertex, weight int)

AddEdge adds an edge to the graph

func (*Graph) AddVertex

func (g *Graph) AddVertex(value any) *Vertex

AddVertex adds a vertex to the graph

func (*Graph) BellmanFord

func (g *Graph) BellmanFord(source *Vertex) (map[*Vertex]int, map[*Vertex]*Vertex, bool)

BellmanFord performs the Bellman-Ford algorithm on the graph

func (*Graph) BreadthFirstSearch

func (g *Graph) BreadthFirstSearch()

BreadthFirstSearch performs a breadth-first search on the graph

func (*Graph) DepthFirstSearch

func (g *Graph) DepthFirstSearch()

DepthFirstSearch performs a depth-first search on the graph

func (*Graph) Dijkstra

func (g *Graph) Dijkstra(source *Vertex)

Dijkstra performs Dijkstra's algorithm on the graph

func (*Graph) Display

func (g *Graph) Display()

Display displays the graph

func (*Graph) FloydWarshall

func (g *Graph) FloydWarshall() (map[*Vertex]map[*Vertex]int, map[*Vertex]map[*Vertex]*Vertex)

FloydWarshall performs the Floyd-Warshall algorithm on the graph

func (*Graph) IsBipartite

func (g *Graph) IsBipartite() bool

IsBipartite checks if the graph is bipartite

func (*Graph) IsCaterpillar

func (g *Graph) IsCaterpillar() bool

IsCaterpillar checks if the graph is a caterpillar graph

func (*Graph) IsComplete

func (g *Graph) IsComplete() bool

IsComplete checks if the graph is complete

func (*Graph) IsCompleteBipartite

func (g *Graph) IsCompleteBipartite() bool

IsCompleteBipartite checks if the graph is a complete bipartite graph

func (*Graph) IsConnected

func (g *Graph) IsConnected() bool

IsConnected checks if the graph is connected

func (*Graph) IsCycle

func (g *Graph) IsCycle() bool

IsCycle checks if the graph is a cycle graph

func (*Graph) IsCyclic

func (g *Graph) IsCyclic() bool

IsCyclic checks if the graph contains a cycle

func (*Graph) IsEquitable

func (g *Graph) IsEquitable() bool

IsEquitable checks if the graph is equitable

func (*Graph) IsEulerian

func (g *Graph) IsEulerian() bool

IsEulerian checks if the graph is Eulerian

func (*Graph) IsForest

func (g *Graph) IsForest() bool

IsForest checks if the graph is a forest

func (*Graph) IsGrid

func (g *Graph) IsGrid() bool

IsGrid checks if the graph is a grid graph

func (*Graph) IsHamiltonian

func (g *Graph) IsHamiltonian() bool

IsHamiltonian checks if the graph is Hamiltonian

func (*Graph) IsIsogonal

func (g *Graph) IsIsogonal(other *Graph) bool

IsIsogonal checks if the graph is isogonal to another graph

func (*Graph) IsIsometric

func (g *Graph) IsIsometric(other *Graph) bool

IsIsometric checks if the graph is isometric to another graph

func (*Graph) IsIsomorphic

func (g *Graph) IsIsomorphic(other *Graph) bool

IsIsomorphic checks if the graph is isomorphic to another graph

func (*Graph) IsLadder

func (g *Graph) IsLadder() bool

IsLadder checks if the graph is a ladder graph

func (*Graph) IsMinor

func (g *Graph) IsMinor(other *Graph) bool

IsMinor checks if the graph is a minor of another graph

func (*Graph) IsPath

func (g *Graph) IsPath() bool

IsPath checks if the graph is a path graph

func (*Graph) IsPlanar

func (g *Graph) IsPlanar() bool

IsPlanar checks if the graph is planar

func (*Graph) IsRegular

func (g *Graph) IsRegular() bool

IsRegular checks if the graph is regular

func (*Graph) IsStar

func (g *Graph) IsStar() bool

IsStar checks if the graph is a star graph

func (*Graph) IsStronglyConnected

func (g *Graph) IsStronglyConnected() bool

IsStronglyConnected checks if the graph is strongly connected

func (*Graph) IsSubdivision

func (g *Graph) IsSubdivision(other *Graph) bool

IsSubdivision checks if the graph is a subdivision of another graph

func (*Graph) IsSubgraph

func (g *Graph) IsSubgraph(other *Graph) bool

IsSubgraph checks if the graph is a subgraph of another graph

func (*Graph) IsTree

func (g *Graph) IsTree() bool

IsTree checks if the graph is a tree

func (*Graph) IsWheel

func (g *Graph) IsWheel() bool

IsWheel checks if the graph is a wheel graph

func (*Graph) Kruskal

func (g *Graph) Kruskal() (map[*Vertex]*Vertex, int)

Kruskal performs Kruskal's algorithm on the graph

func (*Graph) Prim

func (g *Graph) Prim() (map[*Vertex]*Vertex, int)

Prim performs Prim's algorithm on the graph

func (*Graph) TopologicalSort

func (g *Graph) TopologicalSort() []any

TopologicalSort performs a topological sort on the graph

type Vertex

type Vertex struct {
	Value any
	Edges []*Edge
}

Vertex represents a vertex in the graph

Jump to

Keyboard shortcuts

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