graph

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Graph representation of service units Uses more efficient data structure, Adjacency List, compared to graphml package that uses list of nodes and edges.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph struct {
	Nodes     map[string]*Node    // Node ID -> Node
	Adjacency map[string][]string // Node ID -> List of neighbors
}

func (*Graph) AddEdge

func (g *Graph) AddEdge(source, target string)

Adds a directed edge to the graph

func (*Graph) AddNode

func (g *Graph) AddNode(nodeID string, data map[string]interface{})

Adds a node to the graph

func (*Graph) CalculateRecursiveCalls

func (g *Graph) CalculateRecursiveCalls() map[string]int

Wrapper function to calculate recursive calls for all nodes

func (*Graph) CountReachable

func (g *Graph) CountReachable(nodeID string, visited map[string]bool) int

DFS to count reachable nodes

type Node

type Node struct {
	ID   string
	Data map[string]interface{}
}

Jump to

Keyboard shortcuts

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