You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
691 B
Go

package main
import (
"fmt"
// "github.com/goccy/go-graphviz"
"github.com/goccy/go-graphviz/cgraph"
)
func walk(re RoomExit, g *cgraph.Graph) error {
sg := g.SubGraph("cluster_"+re.Name.String, 1)
sg.SetLabel(re.Name.String)
origin, err := sg.CreateNode(re.Fromuid.String)
origin.SetLabel(re.Name.String)
if err != nil {
return fmt.Errorf("error creating origin node: %w", err)
}
dest, err := sg.CreateNode(re.Touid.String)
if err != nil {
return fmt.Errorf("error creating destination node: %w", err)
}
_, err = g.CreateEdge(re.String(), origin, dest)
if err != nil {
return fmt.Errorf("error creating edge between origin and destination: %w", err)
}
return nil
}