Convert the edge data to another topology
187667
public static int nvgraphConvertTopology(
        nvgraphHandle handle, 
        int srcTType, 
        Object srcTopology, 
        Pointer srcEdgeData, 
        Pointer dataType, 
        int dstTType, 
        Object dstTopology, 
        Pointer dstEdgeData)
    {
        return checkResult(nvgraphConvertTopologyNative(handle, srcTType, srcTopology, srcEdgeData, dataType, dstTType, dstTopology, dstEdgeData));
    }
593328
function edge(a, b) {
  if (a.row > b.row) { var t = a; a = b; b = t; }
  return {
    x0: a.column,
    y0: a.row,
    x1: b.column,
    y1: b.row,
    dx: b.column - a.column,
    dy: b.row - a.row
  };
}
99222
def from_edges(edges):
        
        dag = DirectedGraph()
        for _u, _v in edges:
            dag.add_edge(_u, _v)
        return dag
322357
def restore_edge(self, edge):
        
        try:
            head_id, tail_id, data = self.hidden_edges[edge]
            self.nodes[tail_id][0].append(edge)
            self.nodes[head_id][1].append(edge)
            self.edges[edge] = head_id, tail_id, data
            del self.hidden_edges[edge]
        except KeyError:
            raise GraphError('Invalid edge %s' % edge)
672283
def _txtinfo_to_jsoninfo(self, data):
        
        # replace INFINITE with inf, which is convertible to float
        data = data.replace('INFINITE', 'inf')
        # find interesting section
        lines = data.split('\n')

        # process links in topology section
        try:
            start = lines.index('Table: Topology') + 2
            end = lines[start:].index('') + start
        except ValueError:
            raise ParserError('Unrecognized format')
        topology_lines = lines[start:end]
        # convert topology section to jsoninfo format
        topology = []
        for line in topology_lines:
            values = line.split('\t')
            topology.append({
                'destinationIP': values[0],
                'lastHopIP': values[1],
                'linkQuality': float(values[2]),
                'neighborLinkQuality': float(values[3]),
                'tcEdgeCost': float(values[4]) * 1024.0
            })

        # process alias (MID) section
        try:
            start = lines.index('Table: MID') + 2
            end = lines[start:].index('') + start
        except ValueError:
            raise ParserError('Unrecognized format')
        mid_lines = lines[start:end]
        # convert mid section to jsoninfo format
        mid = []
        for line in mid_lines:
            values = line.split('\t')
            node = values[0]
            aliases = values[1].split(';')
            mid.append({
                'ipAddress': node,
                'aliases': [{'ipAddress': alias} for alias in aliases]
            })

        return {
            'topology': topology,
            'mid': mid
        }
840465
def to(self, to):
        
        if self._type.lower() != 'edge':
            raise ValueError('Cannot set From/To to non-edge objects')
        self._to = to
        return self
138078
def _canonicalize_edge_modifications(edge_data: EdgeData) -> Optional[Tuple]:
    """"""
    if edge_data is None:
        return

    modifier = edge_data.get(MODIFIER)
    location = edge_data.get(LOCATION)
    effect = edge_data.get(EFFECT)

    if modifier is None and location is None:
        return

    result = []

    if modifier == ACTIVITY:
        if effect:
            effect_name = effect.get(NAME)
            effect_identifier = effect.get(IDENTIFIER)

            t = (
                ACTIVITY,
                effect[NAMESPACE],
                effect_name or effect_identifier,
            )

        else:
            t = (ACTIVITY,)

        result.append(t)

    elif modifier == DEGRADATION:
        t = (DEGRADATION,)
        result.append(t)

    elif modifier == TRANSLOCATION:
        if effect:
            from_loc_name = effect[FROM_LOC].get(NAME)
            from_loc_identifier = effect[FROM_LOC].get(IDENTIFIER)
            to_loc_name = effect[TO_LOC].get(NAME)
            to_loc_identifier = effect[TO_LOC].get(IDENTIFIER)

            t = (
                TRANSLOCATION,
                edge_data[EFFECT][FROM_LOC][NAMESPACE],
                from_loc_name or from_loc_identifier,
                edge_data[EFFECT][TO_LOC][NAMESPACE],
                to_loc_name or to_loc_identifier,
            )
        else:
            t = (TRANSLOCATION,)
        result.append(t)

    if location:
        location_name = location.get(NAME)
        location_identifier = location.get(IDENTIFIER)

        t = (
            LOCATION,
            location[NAMESPACE],
            location_name or location_identifier,
        )
        result.append(t)

    if not result:
        raise ValueError('Invalid data: {}'.format(edge_data))

    return tuple(result)
141974
def create_edge(self, from_doc, to_doc, edge_data={}):
        

        return Edge.create(
            collection=self,
            from_doc=from_doc,
            to_doc=to_doc,
            edge_data=edge_data
        )
138915
def transposed(self):
        
        return Graph(steps=self.steps, dag=self.dag.transpose())
1301466
protected static Iterable<TitanVertex> edges2Vertices(final Iterable<TitanEdge> edges, final TitanVertex other) {
        return Iterables.transform(edges, new Function<TitanEdge, TitanVertex>() {
            @Nullable
            @Override
            public TitanVertex apply(@Nullable TitanEdge titanEdge) {
                return titanEdge.otherVertex(other);
            }
        });
    }
1106228
def _data_graph_add_edge(self, src, dst, **edge_labels):
        

        if src in self._data_graph and dst in self._data_graph[src]:
            return

        self._data_graph.add_edge(src, dst, **edge_labels)

        self._simplified_data_graph = None
18056
def _rm_gos_edges(rm_goids, edges_all):
        """"""
        edges_reduced = []
        for goid_child, goid_parent in sorted(edges_all, key=lambda t: t[1]):
            if goid_child not in rm_goids and goid_parent not in rm_goids:
                edges_reduced.append((goid_child, goid_parent))
        return edges_reduced
1065740
def _edges_to_adjacency_list(edges):
    """"""
    adj = {}
    for i, j in edges:
        if i in adj:  # pragma: no cover
            ni = adj[i]
        else:
            ni = adj[i] = set()
        if j in adj:
            nj = adj[j]
        else:
            nj = adj[j] = set()
        ni.add(j)
        nj.add(i)
    return adj
65607
def val_to_bin(edges, x):
    """"""
    ibin = np.digitize(np.array(x, ndmin=1), edges) - 1
    return ibin
635738
public void convert( FeatureGraph2D graph ) {
		graph.nodes.resize(corners.size);
		graph.reset();
		for (int i = 0; i < corners.size; i++) {
			Node c = corners.get(i);
			FeatureGraph2D.Node n = graph.nodes.grow();
			n.reset();
			n.set(c.x,c.y);
			n.index = c.index;
		}

		for (int i = 0; i < corners.size; i++) {
			Node c = corners.get(i);
			for (int j = 0; j < 4; j++) {
				if( c.edges[j] == null )
					continue;
				graph.connect(c.index,c.edges[j].index);
			}
		}
	}
971681
def unshift_edge(edge)
	    @vertices.unshift(edge.last) unless edge.last == @edges.first.first
	    @vertices.unshift(edge.first) # unless edge.first == @edges.last.last
	    @vertices.pop if @vertices.last == @vertices.first
	    @edges.unshift(edge)
	end
1278084
def stem(u, v, dfs_data):
    """"""
    #return dfs_data['graph'].get_first_edge_id_by_node_ids(u, v)
    uv_edges = dfs_data['graph'].get_edge_ids_by_node_ids(u, v)
    buv_edges = B(u, v, dfs_data)
    for edge_id in uv_edges:
        if edge_id in buv_edges:
            return edge_id
    return None