package service import ( "bugulma/backend/internal/domain" "bugulma/backend/internal/graph" "context" ) // GraphTraversalService provides advanced graph database operations for industrial symbiosis analysis // This service wraps the graph package Calculator interface type GraphTraversalService struct { calculator graph.Calculator } // NewGraphTraversalService creates a new graph traversal service func NewGraphTraversalService(calculator graph.Calculator) *GraphTraversalService { return &GraphTraversalService{ calculator: calculator, } } // FindResourceChains finds chains of resource flows from waste to reuse func (s *GraphTraversalService) FindResourceChains( ctx context.Context, startResourceType domain.ResourceType, maxChainLength int, minValue float64, ) ([]*graph.ResourceChain, error) { return s.calculator.FindResourceChains(ctx, startResourceType, maxChainLength, minValue) } // FindSymbiosisNetworks identifies interconnected industrial symbiosis networks func (s *GraphTraversalService) FindSymbiosisNetworks( ctx context.Context, minOrganizations int, maxNetworkSize int, ) ([]*graph.SymbiosisNetwork, error) { return s.calculator.FindSymbiosisNetworks(ctx, minOrganizations, maxNetworkSize) } // FindOptimalResourcePaths finds the most cost-effective paths for resource flows func (s *GraphTraversalService) FindOptimalResourcePaths( ctx context.Context, sourceOrgID string, targetOrgID string, resourceType domain.ResourceType, maxHops int, ) ([]*graph.ResourceChain, error) { return s.calculator.FindOptimalResourcePaths(ctx, sourceOrgID, targetOrgID, resourceType, maxHops) } // AnalyzeNetworkCentrality calculates centrality measures for organizations func (s *GraphTraversalService) AnalyzeNetworkCentrality( ctx context.Context, ) (map[string]*graph.CentralityMetrics, error) { return s.calculator.AnalyzeNetworkCentrality(ctx) } // GetNetworkStatistics provides overall network statistics func (s *GraphTraversalService) GetNetworkStatistics(ctx context.Context) (*graph.NetworkStatistics, error) { return s.calculator.GetNetworkStatistics(ctx) } // FindCircularEconomyCycles finds circular resource flow cycles func (s *GraphTraversalService) FindCircularEconomyCycles(ctx context.Context) ([]*graph.CircularEconomyCycle, error) { return s.calculator.FindCircularEconomyCycles(ctx) }