// newNode returns a new node for the given identifier. func (r *randomGraph) newNode(i int) (*node.Node, error) { id, err := node.NewID(fmt.Sprintf("%d", i)) if err != nil { return nil, err } return node.NewNode(r.nodeType, id), nil }
// newNode returns a new node for the given identifier. func (t *treeGenerator) newNode(branch int, parentID string) (*node.Node, error) { tid := fmt.Sprintf("%d/%s", branch, parentID) if parentID == "" { tid = fmt.Sprintf("%d", branch) } id, err := node.NewID(tid) if err != nil { return nil, err } return node.NewNode(t.nodeType, id), nil }