Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# Copyright 2011-2016 Kwant authors. 

2# 

3# This file is part of Kwant. It is subject to the license terms in the file 

4# LICENSE.rst found in the top-level directory of this distribution and at 

5# https://kwant-project.org/license. A list of Kwant authors can be found in 

6# the file AUTHORS.rst at the top-level directory of this distribution and at 

7# https://kwant-project.org/authors. 

8  

9cimport numpy as np 

10from cpython cimport array 

11from .defs cimport gint 

12  

13cdef struct Edge: 

14 gint tail, head 

15  

16cdef class Graph: 

17 cdef int allow_negative_nodes 

18 cdef Edge *edges 

19 cdef gint capacity, size, _num_nodes 

20 cdef gint num_pp_edges, num_pn_edges, num_np_edges 

21  

22 cpdef reserve(self, gint capacity) 

23 cpdef gint add_edge(self, gint tail, gint head) except -1 

24 cdef _add_edges_ndarray_int64(self, np.ndarray[np.int64_t, ndim=2] edges) 

25 cdef _add_edges_ndarray_int32(self, np.ndarray[np.int32_t, ndim=2] edges) 

26  

27cdef class gintArraySlice: 

28 cdef gint *data 

29 cdef gint size 

30  

31cdef class CGraph: 

32 cdef readonly bint twoway, edge_nr_translation 

33 cdef readonly gint num_nodes, num_edges, num_px_edges, num_xp_edges 

34 cdef array.array _heads_idxs 

35 cdef gint *heads_idxs 

36 cdef array.array _heads 

37 cdef gint *heads 

38 cdef array.array _tails_idxs 

39 cdef gint *tails_idxs 

40 cdef array.array _tails 

41 cdef gint *tails 

42 cdef array.array _edge_ids 

43 cdef gint *edge_ids 

44 cdef array.array _edge_ids_by_edge_nr 

45 cdef gint *edge_ids_by_edge_nr 

46 cdef gint edge_nr_end 

47  

48 cpdef gintArraySlice out_neighbors(self, gint node) 

49  

50  

51cdef class CGraph_malloc(CGraph): 

52 pass 

53  

54cdef class EdgeIterator: 

55 cdef CGraph graph 

56 cdef gint edge_id, tail