package layoutgraph

import (
	
	

	
	
)

func ( context.Context,  string) (context.Context, *limits.WorkGuard, error) {
	return ensureTransactionWorkGuard(, )
}

// ExistingTransactionWorkGuard checks and returns the request's aggregate
// transaction guard without allocating a derived context or standalone budget.
func ( context.Context,  string) (*limits.WorkGuard, bool, error) {
	return existingTransactionWorkGuard(, )
}

// GraphStateSnapshotOptions selects the topology and route identity captured
// by a rollback snapshot.
type GraphStateSnapshotOptions struct {
	CaptureTopology   bool
	CaptureEdgeRoutes bool
}

// NewGraphStateSnapshot creates an empty rollback snapshot with the requested
// capture scope.
func ( GraphStateSnapshotOptions) *GraphState {
	return &GraphState{
		captureTopology:   .CaptureTopology,
		captureEdgeRoutes: .CaptureEdgeRoutes,
	}
}

func ( *GraphState) ( *Graph,  *limits.WorkGuard) error {
	return .updateContext(, )
}

// OwnedNodes returns every node whose state is owned by g, including graph
// nodes temporarily removed by tree or sequence preprocessing. It charges the
// same work units in the same traversal order as the former hierarchy code.
func ( *GraphState) ( *Graph,  *limits.WorkGuard) (map[*Node]struct{}, error) {
	 := make(map[*Node]struct{}, len(.nodes))
	for ,  := range .Nodes {
		if  := .Step();  != nil {
			return nil, 
		}
		[] = struct{}{}
	}
	for  := range .nodes {
		if  := .Step();  != nil {
			return nil, 
		}
		if .Graph ==  {
			[] = struct{}{}
		}
	}
	return , nil
}

func ( context.Context,  string,  *Graph) error {
	return validateEngineGraph(, , )
}

func ( *Graph) () bool {
	return .hasFixedNode()
}

func ( *Graph) ( *Node,  bool) []*Node {
	return .allDescendantNodes(, )
}

func ( *Graph) ( *Node,  *Graph) []*EdgeAbduction {
	return .abductEdges(, )
}

func ( *Graph) ( []*EdgeAbduction) []*EdgeAbduction {
	return .restoreEdgeAbductions()
}

// ReplaceEdgesUnchecked replaces graph edge ownership and rebuilds both
// endpoint incidence lists. The caller is responsible for supplying valid
// graph-owned endpoints.
func ( *Graph) ( []*Edge) {
	for ,  := range .Edges {
		.From.Edges = nil
		.To.Edges = nil
	}
	.Edges = 
	for ,  := range  {
		.From.addEdge()
		.To.addEdge()
	}
}

func ( *Graph) ( *Node,  bool) Spacing {
	return .containerPadding(, )
}

func ( float64) Spacing {
	return Spacing{top: , bottom: , left: , right: }
}

func ( Spacing) () float64 {
	return .left
}

func ( Spacing) () float64 {
	return .right
}

func ( Nodes) ( *Graph) {
	.setGraphReference()
}

func ( Nodes) () *geo.Point {
	return .center()
}

func ( Nodes) ( *limits.WorkGuard) (*geo.Point, error) {
	if  == nil {
		return nil, fmt.Errorf("TALA Center requires a work guard")
	}
	return .centerWithWorkGuard()
}

func ( Nodes) () (*geo.Point, *geo.Point) {
	return .bounds()
}

func ( Nodes) ( *limits.WorkGuard) (*geo.Point, *geo.Point, error) {
	if  == nil {
		return nil, nil, fmt.Errorf("TALA BoundingBox requires a work guard")
	}
	return .boundsWithWorkGuard()
}

func ( *Node) () bool {
	return  != nil && .isContainer
}

func ( *Node) () bool {
	return .shapeType == tableType
}

func ( *Node) ( bool) {
	.isClusterVessel = 
}

func ( *Node) ( *Edge) *Node {
	return .adjacent()
}

func ( *Node) () *geo.Point {
	return .center()
}

func ( *Node) (,  float64) {
	.translate(, )
}

func ( *Node) () {
	.transpose()
}

func ( *Node) (,  bool) {
	.mirror(, )
}

func ( *Node) (,  *geo.Point,  Spacing) {
	.fitToBoundingBox(, , )
}

func ( *Node) () {
	.wrapChildren()
}

func ( *Edge) () bool {
	return  != nil && .isLoop()
}

func ( *Edge) () bool {
	return .isDirected()
}

func ( *Edge) () (,  *Node,  bool) {
	return .directedEndpoints()
}

func ( *Edge) ( *Node) bool {
	return .isTargetedTo()
}

func ( *Edge) () bool {
	return .isBetweenTableColumns()
}

// HierarchyRankWeight returns the authored-edge multiplicity represented by a
// temporary hierarchy DAG edge. Ordinary graph edges have implicit weight 1.
func ( *Edge) () int {
	if  == nil || !.hierarchyRankWeightSet {
		return 1
	}
	return .hierarchyRankWeight
}

// SetHierarchyRankWeight records temporary hierarchy DAG metadata. It is kept
// out of graph serialization and reset by ordinary graph cloning.
func ( *Edge) ( int) {
	.hierarchyRankWeight = 
	.hierarchyRankWeightSet = true
}