add attributes to segment nodes, as well as edges to/from other
        segments/groups. add segment to list of EDUs.

        Parameters
        ----------
        segment : ??? etree Element
2448
def __add_segment(self, segment):
        
        segment_id = self.ns+':'+segment.attrib['id']
        self.edus.append(segment_id)  # store RST segment in list of EDUs

        # A URML file can be tokenized, partially tokenized or not tokenized
        # at all. The "tokenized tokens" in the URML file will always be added
        # to the graph as nodes. The "untokenized tokens" will only be added,
        # if ``self.tokenize`` is ``True``.

        if is_segment_tokenized(segment):
            self.tokenized = True
            segment_text = sanitize_string(
                ' '.join(e.text for e in segment if e.text is not None))

            for i, tok_elem in enumerate(segment):
                tok = tok_elem.text
                self.__add_token(segment_id, i, tok)

        else:  # is_segment_tokenized(segment) is False
            segment_text = sanitize_string(segment.text)
            segment_toks = segment_text.split()

            if self.tokenize:
                self.tokenized = True
                for i, tok in enumerate(segment_toks):
                    self.__add_token(segment_id, i, tok)

        segment_type = self.segment_types[segment_id]
        segment_label = get_segment_label(
            segment, segment_type, segment_text, self.ns, self.tokenize)
        self.add_node(
            segment_id, layers={self.ns, self.ns+':segment'},
            attr_dict={self.ns+':text' : segment_text,
                       'label':  segment_label})
1083294
def add_edge(self, source, target, interaction='-', directed=True, dataframe=True):
        
        new_edge = {
            'source': source,
            'target': target,
            'interaction': interaction,
            'directed': directed
        }
        return self.add_edges([new_edge], dataframe=dataframe)
822707
private static void add(Polygon poly, int flag, ArrayList<SegmentString> segments) {
        add(poly.getExteriorRing(), flag, segments);
        for (int j = 0; j < poly.getNumInteriorRing(); j++) {
            add(poly.getInteriorRingN(j), flag, segments);
        }
    }
444035
def add_graph(self, other):
        
        self.add_nodes( n for n in other.nodes() if not n in self.nodes() )
        
        for each_node in other.nodes():
            for each_edge in other.neighbors(each_node):
                if (not self.has_edge((each_node, each_edge))):
                    self.add_edge((each_node, each_edge))
938863
def segment(self, eps, min_time):
        
        new_segments = []
        for segment in self.segments:
            segmented = segment.segment(eps, min_time)
            for seg in segmented:
                new_segments.append(Segment(seg))
        self.segments = new_segments
        return self
670733
def add_child(self, story_element_type=None, outline=None, name=None, description=None, **kwargs):
        '''
        
        '''
        if not outline:
            outline = self.outline
        if outline != self.outline:
            raise IntegrityError('Elements must be from the same outline!')
        tree_manipulation.send(
            sender=self.__class__,
            instance=self,
            action='add_child',
            target_node_type=story_element_type,
            target_node=None,
            pos=None
        )
        return super().add_child(
            story_element_type=story_element_type,
            outline=outline,
            name=name,
            description=description,
            **kwargs
        )
1222575
def add_subsegment(self, subsegment):
        
        super(Subsegment, self).add_subsegment(subsegment)
        self.parent_segment.increment()
1231199
def add_edge(self, u, v, key=None, attr_dict=None, **attr):
        """"""
        if attr_dict is None:
            attr_dict = attr
        else:
            try:
                attr_dict.update(attr)
            except AttributeError:
                raise NetworkXError(
                    "The attr_dict argument must be a dictionary."
                )
        if u not in self.node:
            self.node[u] = {}
        if v not in self.node:
            self.node[v] = {}
        if v in self.succ[u]:
            keydict = self.adj[u][v]
            if key is None:
                key = len(keydict)
                while key in keydict:
                    key += 1
            datadict = keydict.get(key, {})
            datadict.update(attr_dict)
            keydict[key] = datadict
        else:
            if key is None:
                key = 0
            datadict = {}
            datadict.update(attr_dict)
            keydict = {key: datadict}
            self.succ[u][v] = keydict
        return key
1222503
def _add_nodes(self):
        """"""
        for n, atom in enumerate(self.ast.select('atom')):
            self.add_node(n, atom=atom)
            self._atom_indices[id(atom)] = n
364310
def add_subsegment(self, subsegment):
        
        self._check_ended()
        subsegment.parent_id = self.id
        self.subsegments.append(subsegment)
303297
private void addFirstSegment(int x, int y) {
		Point2D_I32 p = queuePoints.grow();
		p.set(x,y);
		EdgeSegment s = new EdgeSegment();
		s.points.add(p);
		s.index = 0;
		s.parent = s.parentPixel = -1;
		e.segments.add(s);
		open.add(s);
	}
417289
def add_edge(self, u, v, **attr):
        
        if u not in self.vertices:
            self.vertices[u] = []
            self.pred[u] = []
            self.succ[u] = []
        if v not in self.vertices:
            self.vertices[v] = []
            self.pred[v] = []
            self.succ[v] = []
        vertex = (u, v)
        self.edges[vertex] = {}
        self.edges[vertex].update(attr)
        self.vertices[u].append(v)
        self.pred[v].append(u)
        self.succ[u].append(v)
1047865
def _add_token(self, token, parent_node='root'):
        """"""
        if parent_node == 'root':
            parent_node = self.root

        token_node_id = 'token:{}'.format(self.token_count)
        self.add_node(token_node_id, layers={self.ns, self.ns+':token'},
                      attr_dict={self.ns+':token': token})
        self.add_edge(parent_node, token_node_id,
                      layers={self.ns},
                      edge_type=EdgeTypes.spanning_relation)
        self.tokens.append(token_node_id)
        self.token_count += 1
48411
def graph_add_node(self, node_object):
        
        if ((node_object not in self._graph.nodes()) and
            (isinstance(node_object, (StationDing0,
                                      CableDistributorDing0,
                                      LVLoadAreaCentreDing0,
                                      CircuitBreakerDing0,
                                      GeneratorDing0)))):
            self._graph.add_node(node_object)
96522
def _add_element(self, element, parent_node):
        
        if element.tag == 'unit':
            element_node_id = element.attrib['id']+':'+element.attrib['type']
            node_layers = {self.ns, self.ns+':unit', self.ns+':'+element.attrib['type']}
        elif element.tag == 'connective':
            element_node_id = element.attrib['id']+':connective'
            node_layers = {self.ns, self.ns+':connective'}
        elif element.tag == 'discourse':
            element_node_id = 'discourse'
            node_layers = {self.ns}
        else:  # <modifier>
            element_node_id = element.getparent().attrib['id']+':'+element.tag
            node_layers = {self.ns, self.ns+':modifier'}

        self.add_node(element_node_id, layers=node_layers)
        self.add_edge(parent_node, element_node_id, layers={self.ns},
                      edge_type=EdgeTypes.dominance_relation)

        if element.text:
            if self.tokenize:
                for token in element.text.split():
                    self._add_token(token, element_node_id)
            else:
                element_text = sanitize_string(element.text)
                self.node[element_node_id].update(
                    {'label': u"{0}: {1}...".format(element_node_id,
                                                   element_text[:20])})


        for child_element in element.iterchildren():
            self._add_element(child_element, element_node_id)

        if element.tail:  # tokens _after_ the </element> closes
            if self.tokenize:
                for token in element.tail.split():
                    self._add_token(token, parent_node)
            else:
                tail_text = sanitize_string(element.tail)
                self.node[parent_node].update(
                    {'label': u"{0}: {1}...".format(parent_node,
                                                    tail_text[:20])})
1366011
def setup_intelligent_segments
      segments = Octo.get_config(:intelligent_segments)
      if segments
        segments.each do |seg|
          args = {
            enterprise_id: self._id,
            name: seg[:name],
            type: seg[:type].constantize,
            dimensions: seg[:dimensions].collect(&:constantize),
            operators: seg[:operators].collect(&:constantize),
            values: seg[:values].collect(&:constantize),
            active: true,
            intelligence: true,
          }
          Octo::Segment.new(args).save!
        end
        Octo.logger.info "Created segents for Enterprise: #{ self.name }"
      end
    end
863221
def add_node_attribute(self, node, attr):
        
        self.node_attr[node] = self.node_attr[node] + [attr]