Return a query selecting all edge ids that only belong to the given network.
184815
def query_singleton_edges_from_network(self, network: Network) -> sqlalchemy.orm.query.Query:
        """"""
        ne1 = aliased(network_edge, name='ne1')
        ne2 = aliased(network_edge, name='ne2')
        singleton_edge_ids_for_network = (
            self.session
                .query(ne1.c.edge_id)
                .outerjoin(ne2, and_(
                ne1.c.edge_id == ne2.c.edge_id,
                ne1.c.network_id != ne2.c.network_id
            ))
                .filter(and_(
                ne1.c.network_id == network.id,
                ne2.c.edge_id == None  # noqa: E711
            ))
        )
        return singleton_edge_ids_for_network
599255
def get_subgraph_from_edge_list(graph, edge_list):
    """"""
    node_list = get_vertices_from_edge_list(graph, edge_list)
    subgraph = make_subgraph(graph, node_list, edge_list)

    return subgraph
141953
def _get_ids_from_ip(self, ip):  # pylint: disable=inconsistent-return-statements
        """"""
        try:
            # Does it look like an ip address?
            socket.inet_aton(ip)
        except socket.error:
            return []

        # Find the server via ip address. First try public ip, then private
        results = self.list_hardware(public_ip=ip, mask="id")
        if results:
            return [result['id'] for result in results]

        results = self.list_hardware(private_ip=ip, mask="id")
        if results:
            return [result['id'] for result in results]
377344
def get_by_id(self, id_networkv4):
        

        uri = 'api/networkv4/%s/' % id_networkv4

        return super(ApiNetworkIPv4, self).get(uri)
38732
def get_network(network_id):
    """"""
    try:
        net = models.Network.query.filter_by(id=network_id).one()
    except NoResultFound:
        return error_response(
            error_type="/network GET: no network found",
            status=403)

    # return the data
    return success_response(field="network",
                            data=net.__json__(),
                            request_type="network get")
1026345
def neighbors(self, obj):
        
        neighbors = set([])
        
        for e in self.node_links[obj]:
            neighbors.update(set(self.edge_links[e]))
        
        return list(neighbors - set([obj]))
550503
def query_nodes(query)
      collection = connection[nodes_collection]
      collection.find(query).batch_size(999).projection(_id: 1).map { |k| k[:_id] }
    end
13225
def only_path(self):
        """"""
        start = [v for v in self.nodes if self.nodes[v].get('start', False)]
        if len(start) != 1: 
            raise ValueError("graph does not have exactly one start node")

        path = []
        [v] = start
        while True:
            path.append(v)
            u = v
            vs = self.edges.get(u, ())
            if len(vs) == 0:
                break
            elif len(vs) > 1:
                raise ValueError("graph does not have exactly one path")
            [v] = vs

        return path
1244722
def get_edge(self, edge_id):
        """"""
        try:
            edge_object = self.edges[edge_id]
        except KeyError:
            raise NonexistentEdgeError(edge_id)
        return edge_object
1021533
def select_edges(docgraph, conditions, data):
    """"""
    for (src_id, target_id, edge_attribs) in docgraph.edges(data=True):
        # if all conditions are fulfilled
        # we need to add edge_attribs to the namespace eval is working in
        if all((eval(cond, {'edge_attribs': edge_attribs})
                for cond in conditions)):
            if data:
                yield (src_id, target_id, edge_attribs)
            else:
                yield (src_id, target_id)
361841
def get_node_edges(self,node,type="both"):
    
    if type == "both":
      return [self.__edges[x] for x in self.__edges if node.id in self.__edges[x].get_node_ids()]
    elif type == "outgoing":
      return [self.__edges[x] for x in self.__edges if node.id == self.__edges[x].get_node_ids()[0]]
    elif type == "incoming":
      return [self.__edges[x] for x in self.__edges if node.id == self.__edges[x].get_node_ids()[1]]
    sys.stderr.write("ERROR: type is not a type "+type+"\n")
    sys.exit()
941011
def get_by_id(self, id_networkv6):
        

        uri = 'api/networkv4/%s/' % id_networkv6
        return super(ApiNetworkIPv6, self).get(uri)
583085
def get_child_nodes(docgraph, parent_node_id, data=False):
    """"""
    return select_neighbors_by_edge_attribute(
        docgraph=docgraph,
        source=parent_node_id,
        attribute='edge_type',
        value=[EdgeTypes.dominance_relation],
        data=data)
346228
def find(self, i):
        '''
        
        '''
        current = i
        edge_list = []
        while len(self.get_neighbors(current)) != 0:
            successor = self.get_neighbors(current)[0]
            edge_list.append((current, successor))
            current = successor
        if self.optimize:
            for e in edge_list:
                if e[1] != current:
                    self.del_edge((e[0], e[1]))
                    self.add_edge(e[0], current)
        return current
173922
public Edge lookupEdgeById(int id) {
        Iterator<Edge> i = edgeIterator();
        while (i.hasNext()) {
            Edge edge = i.next();
            if (edge.getId() == id) {
                return edge;
            }
        }
        return null;
    }
501731
def edges(self, sites, permutation=None, input='sites'):
        
        if input == 'sites':
            coords = [site.coords for site in sites]
        elif input == 'coords':
            coords = sites
        # if permutation is None:
        #     coords = [site.coords for site in sites]
        # else:
        #     coords = [sites[ii].coords for ii in permutation]
        if permutation is not None:
            coords = [coords[ii] for ii in permutation]
        return [[coords[ii] for ii in e] for e in self._edges]
576934
def get_edges_by_hashes(self, edge_hashes: List[str]) -> List[Edge]:
        """"""
        return self.session.query(Edge).filter(Edge.sha512.in_(edge_hashes)).all()