logo资料库

igraph软件包文档.pdf

第1页 / 共804页
第2页 / 共804页
第3页 / 共804页
第4页 / 共804页
第5页 / 共804页
第6页 / 共804页
第7页 / 共804页
第8页 / 共804页
资料共804页,剩余部分请下载后查看
igraph Reference Manual
Table of Contents
List of Examples
Chapter 1. Introduction
1.1. igraph is free software
1.2. Citing igraph
Chapter 2. Installation
Chapter 3. Tutorial
3.1. Lesson 1. Compiling programs using igraph.
3.2. Lesson 2. Creating your first graphs.
3.3. Lesson 3. Calculating various properties of graphs.
Chapter 4. About igraph graphs, the basic interface
4.1. The igraph data model
4.2. The basic interface
4.2.1. Graph Constructors and Destructors
4.2.1.1. igraphempty Creates an empty graph with some vertices and no edges.
4.2.1.2. igraphemptyattrs Creates an empty graph with some vertices, no edges and some graph attributes.
4.2.1.3. igraphcopy Creates an exact (deep) copy of a graph.
4.2.1.4. igraphdestroy Frees the memory allocated for a graph object.
4.2.2. Basic Query Operations
4.2.2.1. igraphvcount The number of vertices in a graph.
4.2.2.2. igraphecount The number of edges in a graph.
4.2.2.3. igraphedge Gives the head and tail vertices of an edge.
4.2.2.4. igraphgeteid Get the edge id from the end points of an edge.
4.2.2.5. igraphgeteids Return edge ids based on the adjacent vertices.
4.2.2.6. igraphgeteidsmulti Query edge ids based on their adjacent vertices, handle multiple edges.
4.2.2.7. igraphneighbors Adjacent vertices to a vertex.
4.2.2.8. igraphincident Gives the incident edges of a vertex.
4.2.2.9. igraphisdirected Is this a directed graph?
4.2.2.10. igraphdegree The degree of some vertices in a graph.
4.2.3. Adding and Deleting Vertices and Edges
4.2.3.1. igraphaddedge Adds a single edge to a graph.
4.2.3.2. igraphaddedges Adds edges to a graph object.
4.2.3.3. igraphaddvertices Adds vertices to a graph.
4.2.3.4. igraphdeleteedges Removes edges from a graph.
4.2.3.5. igraphdeletevertices Removes vertices (with all their edges) from the graph.
4.2.4. Deprecated functions
4.2.4.1. igraphadjacent Gives the incident edges of a vertex.
Chapter 5. Error Handling
5.1. Error handling basics
5.2. Error handlers
5.2.1. igrapherrorhandlert Type of error handler functions.
5.2.2. igrapherrorhandlerabort Abort program in case of error.
5.2.3. igrapherrorhandlerignore Ignore errors.
5.2.4. igrapherrorhandlerprintignore Print and ignore errors.
5.3. Error codes
5.3.1. igrapherrortypet Error code type.
5.3.2. igraphstrerror Textual description of an error.
5.4. Warning messages
5.4.1. igraphwarninghandlert Type of igraph warning handler functions
5.4.2. igraphsetwarninghandler Install a warning handler
5.4.3. IGRAPHWARNING Trigger a warning.
5.4.4. igraphwarning Trigger a warning
5.4.5. igraphwarningf Trigger a warning, more flexible printflike syntax
5.4.6. igraphwarninghandlerignore Ignore all warnings
5.4.7. igraphwarninghandlerprint Print all warning to the standard error
5.5. Advanced topics
5.5.1. Writing error handlers
5.5.1.1. igraphseterrorhandler Set a new error handler.
5.5.2. Error handling internals
5.5.2.1. IGRAPHERROR Trigger an error.
5.5.2.2. igrapherror Trigger an error.
5.5.2.3. igrapherrorf Trigger an error, printflike version.
5.5.2.4. IGRAPHCHECK Check the return value of a function call.
5.5.3. Deallocating memory
5.5.3.1. IGRAPHFINALLY Register an object for deallocation.
5.5.3.2. IGRAPHFINALLYCLEAN Signal clean deallocation of objects.
5.5.3.3. IGRAPHFINALLYFREE Deallocate all registered objects.
5.5.4. Writing igraph functions with proper error handling
5.5.5. Error handling and threads
Chapter 6. Memory (de)allocation
6.1. igraphfree Deallocate memory that was allocated by igraph functions
Chapter 7. Data structure library: vector, matrix, other data types
7.1. About template types
vector
matrix
array3
stack
doubleended queue
heap
7.2. Vectors
7.2.1. About igraphvectort objects
7.2.2. Constructors and Destructors
7.2.2.1. igraphvectorinit Initializes a vector object (constructor).
7.2.2.2. igraphvectorinitcopy Initializes a vector from an ordinary C array (constructor).
7.2.2.3. igraphvectorinitseq Initializes a vector with a sequence.
7.2.2.4. igraphvectorcopy Initializes a vector from another vector object (constructor).
7.2.2.5. igraphvectordestroy Destroys a vector object.
7.2.3. Initializing elements
7.2.3.1. igraphvectornull Sets each element in the vector to zero.
7.2.3.2. igraphvectorfill Fill a vector with a constant element
7.2.4. Accessing elements
7.2.4.1. VECTOR Accessing an element of a vector.
7.2.4.2. igraphvectore Access an element of a vector.
7.2.4.3. igraphvectoreptr Get the address of an element of a vector
7.2.4.4. igraphvectorset Assignment to an element of a vector.
7.2.4.5. igraphvectortail Returns the last element in a vector.
7.2.5. Vector views
7.2.5.1. igraphvectorview Handle a regular C array as a igraphvectort.
7.2.6. Copying vectors
7.2.6.1. igraphvectorcopyto Copies the contents of a vector to a C array.
7.2.6.2. igraphvectorupdate Update a vector from another one.
7.2.6.3. igraphvectorappend Append a vector to another one.
7.2.6.4. igraphvectorswap Swap elements of two vectors.
7.2.7. Exchanging elements
7.2.7.1. igraphvectorswapelements Swap two elements in a vector.
7.2.7.2. igraphvectorreverse Reverse the elements of a vector.
7.2.7.3. igraphvectorshuffle Shuffles a vector inplace using the FisherYates method
7.2.8. Vector operations
7.2.8.1. igraphvectoraddconstant Add a constant to the vector.
7.2.8.2. igraphvectorscale Multiply all elements of a vector by a constant
7.2.8.3. igraphvectoradd Add two vectors.
7.2.8.4. igraphvectorsub Subtract a vector from another one.
7.2.8.5. igraphvectormul Multiply two vectors.
7.2.8.6. igraphvectordiv Divide a vector by another one.
7.2.9. Vector comparisons
7.2.9.1. igraphvectoralle Are all elements equal?
7.2.9.2. igraphvectoralll Are all elements less?
7.2.9.3. igraphvectorallg Are all elements greater?
7.2.9.4. igraphvectorallle Are all elements less or equal?
7.2.9.5. igraphvectorallge Are all elements greater or equal?
7.2.10. Finding minimum and maximum
7.2.10.1. igraphvectormin Smallest element of a vector.
7.2.10.2. igraphvectormax Gives the maximum element of the vector.
7.2.10.3. igraphvectorwhichmin Index of the smallest element.
7.2.10.4. igraphvectorwhichmax Gives the position of the maximum element of the vector.
7.2.10.5. igraphvectorminmax Minimum and maximum elements of a vector.
7.2.10.6. igraphvectorwhichminmax Index of the minimum and maximum elements
7.2.11. Vector properties
7.2.11.1. igraphvectorempty Decides whether the size of the vector is zero.
7.2.11.2. igraphvectorsize Gives the size (=length) of the vector.
7.2.11.3. igraphvectorcapacity Returns the allocated capacity of the vector
7.2.11.4. igraphvectorsum Calculates the sum of the elements in the vector.
7.2.11.5. igraphvectorprod Calculates the product of the elements in the vector.
7.2.11.6. igraphvectorisininterval Checks if all elements of a vector are in the given
7.2.11.7. igraphvectormaxdifference The maximum absolute difference of m1 and m2
7.2.12. Searching for elements
7.2.12.1. igraphvectorcontains Linear search in a vector.
7.2.12.2. igraphvectorsearch Search from a given position
7.2.12.3. igraphvectorbinsearch Finds an element by binary searching a sorted vector.
7.2.12.4. igraphvectorbinsearch2 Binary search, without returning the index.
7.2.13. Resizing operations
7.2.13.1. igraphvectorclear Removes all elements from a vector.
7.2.13.2. igraphvectorreserve Reserves memory for a vector.
7.2.13.3. igraphvectorresize Resize the vector.
7.2.13.4. igraphvectorresizemin Deallocate the unused memory of a vector.
7.2.13.5. igraphvectorpushback Appends one element to a vector.
7.2.13.6. igraphvectorpopback Removes and returns the last element of a vector.
7.2.13.7. igraphvectorinsert Inserts a single element into a vector.
7.2.13.8. igraphvectorremove Removes a single element from a vector.
7.2.13.9. igraphvectorremovesection Deletes a section from a vector.
7.2.14. Sorting
7.2.14.1. igraphvectorsort Sorts the elements of the vector into ascending order.
7.2.15. Set operations on sorted vectors
7.2.15.1. igraphvectorintersectsorted Calculates the intersection of two sorted vectors
7.2.15.2. igraphvectordifferencesorted Calculates the difference between two sorted vectors (considered as sets)
7.2.16. Pointer vectors (igraphvectorptrt)
7.2.16.1. igraphvectorptrinit Initialize a pointer vector (constructor).
7.2.16.2. igraphvectorptrcopy Copy a pointer vector (constructor).
7.2.16.3. igraphvectorptrdestroy Destroys a pointer vector.
7.2.16.4. igraphvectorptrfreeall Frees all the elements of a pointer vector.
7.2.16.5. igraphvectorptrdestroyall Frees all the elements and destroys the pointer vector.
7.2.16.6. igraphvectorptrsize Gives the number of elements in the pointer vector.
7.2.16.7. igraphvectorptrclear Removes all elements from a pointer vector.
7.2.16.8. igraphvectorptrpushback Appends an element to the back of a pointer vector.
7.2.16.9. igraphvectorptre Access an element of a pointer vector.
7.2.16.10. igraphvectorptrset Assign to an element of a pointer vector.
7.2.16.11. igraphvectorptrresize Resizes a pointer vector.
7.2.16.12. igraphvectorptrgetitemdestructor Gets the current item destructor for this pointer vector.
7.2.16.13. igraphvectorptrsetitemdestructor Sets the item destructor for this pointer vector.
7.2.16.14. IGRAPHVECTORPTRSETITEMDESTRUCTOR Sets the item destructor for this pointer vector (macro version).
7.3. Matrices
7.3.1. About igraphmatrixt objects
7.3.2. Matrix constructors and destructors
7.3.2.1. igraphmatrixinit Initializes a matrix.
7.3.2.2. igraphmatrixcopy Copies a matrix.
7.3.2.3. igraphmatrixdestroy Destroys a matrix object.
7.3.3. Initializing elements
7.3.3.1. igraphmatrixnull Sets all elements in a matrix to zero.
7.3.3.2. igraphmatrixfill Fill with an element.
7.3.4. Copying matrices
7.3.4.1. igraphmatrixcopyto Copies a matrix to a regular C array.
7.3.4.2. igraphmatrixupdate Update from another matrix.
7.3.4.3. igraphmatrixswap Swap two matrices.
7.3.5. Accessing elements of a matrix
7.3.5.1. MATRIX Accessing an element of a matrix.
7.3.5.2. igraphmatrixe Extract an element from a matrix.
7.3.5.3. igraphmatrixeptr Pointer to an element of a matrix.
7.3.5.4. igraphmatrixset Set an element.
7.3.6. Operations on rows and columns
7.3.6.1. igraphmatrixgetrow Extract a row.
7.3.6.2. igraphmatrixgetcol Select a column.
7.3.6.3. igraphmatrixsetrow Set a row from a vector.
7.3.6.4. igraphmatrixsetcol Set a column from a vector.
7.3.6.5. igraphmatrixswaprows Swap two rows.
7.3.6.6. igraphmatrixswapcols Swap two columns.
7.3.6.7. igraphmatrixselectrows Select some rows of a matrix.
7.3.6.8. igraphmatrixselectcols Select some columns of a matrix.
7.3.6.9. igraphmatrixselectrowscols Select some rows and columns of a matrix.
7.3.7. Matrix operations
7.3.7.1. igraphmatrixaddconstant Add a constant to every element.
7.3.7.2. igraphmatrixscale Multiplies each element of the matrix by a constant.
7.3.7.3. igraphmatrixadd Add two matrices.
7.3.7.4. igraphmatrixsub Difference of two matrices.
7.3.7.5. igraphmatrixmulelements Elementwise multiplication.
7.3.7.6. igraphmatrixdivelements Elementwise division.
7.3.7.7. igraphmatrixsum Sum of elements.
7.3.7.8. igraphmatrixprod Product of the elements.
7.3.7.9. igraphmatrixrowsum Rowwise sum.
7.3.7.10. igraphmatrixcolsum Columnwise sum.
7.3.7.11. igraphmatrixtranspose Transpose a matrix.
7.3.8. Matrix comparisons
7.3.8.1. igraphmatrixalle Are all elements equal?
7.3.8.2. igraphmatrixalll Are all elements less?
7.3.8.3. igraphmatrixallg Are all elements greater?
7.3.8.4. igraphmatrixallle Are all elements less or equal?
7.3.8.5. igraphmatrixallge Are all elements greater or equal?
7.3.9. Combining matrices
7.3.9.1. igraphmatrixrbind Combine two matrices rowwise.
7.3.9.2. igraphmatrixcbind Combine matrices columnwise.
7.3.10. Finding minimum and maximum
7.3.10.1. igraphmatrixmin Minimum element.
7.3.10.2. igraphmatrixmax Returns the maximal element of a matrix.
7.3.10.3. igraphmatrixwhichmin Indices of the minimum.
7.3.10.4. igraphmatrixwhichmax Indices of the maximum.
7.3.10.5. igraphmatrixminmax Minimum and maximum
7.3.10.6. igraphmatrixwhichminmax Indices of the minimum and maximum
7.3.11. Matrix properties
7.3.11.1. igraphmatrixempty Check for an empty matrix.
7.3.11.2. igraphmatrixisnull Check for a null matrix.
7.3.11.3. igraphmatrixsize The number of elements in a matrix.
7.3.11.4. igraphmatrixcapacity Returns the number of elements allocated for a matrix.
7.3.11.5. igraphmatrixnrow The number of rows in a matrix.
7.3.11.6. igraphmatrixncol The number of columns in a matrix.
7.3.11.7. igraphmatrixissymmetric Check for symmetric matrix.
7.3.11.8. igraphmatrixmaxdifference Maximum absolute difference between two matrices.
7.3.12. Searching for elements
7.3.12.1. igraphmatrixcontains Search for an element.
7.3.12.2. igraphmatrixsearch Search from a given position.
7.3.13. Resizing operations
7.3.13.1. igraphmatrixresize Resizes a matrix.
7.3.13.2. igraphmatrixresizemin Deallocates unused memory for a matrix.
7.3.13.3. igraphmatrixaddrows Adds rows to a matrix.
7.3.13.4. igraphmatrixaddcols Adds columns to a matrix.
7.3.13.5. igraphmatrixremoverow Remove a row.
7.3.13.6. igraphmatrixremovecol Removes a column from a matrix.
7.4. Sparse matrices
7.4.1. About igraphspmatrixt objects
7.4.2. Sparse matrix constructors and destructors.
7.4.2.1. igraphspmatrixinit Initializes a sparse matrix.
7.4.2.2. igraphspmatrixcopy Copies a sparse matrix.
7.4.2.3. igraphspmatrixdestroy Destroys a sparse matrix object.
7.4.3. Accessing elements of a sparse matrix
7.4.3.1. igraphspmatrixe Accessing an element of a sparse matrix.
7.4.3.2. igraphspmatrixset Setting an element of a sparse matrix.
7.4.3.3. igraphspmatrixadde Adding a real value to an element of a sparse matrix.
7.4.4. Iterating over the nonzero elements of a sparse matrix
7.4.4.1. igraphspmatrixitercreate Creates a sparse matrix iterator corresponding to the given matrix.
7.4.4.2. igraphspmatrixiterreset Resets a sparse matrix iterator.
7.4.4.3. igraphspmatrixiternext Moves a sparse matrix iterator to the next nonzero element.
7.4.4.4. igraphspmatrixiterend Checks whether there are more elements in the iterator.
7.4.4.5. igraphspmatrixiterdestroy Frees the memory used by the iterator.
7.4.5. Matrix query operations
7.4.5.1. igraphspmatrixsize The number of elements in a sparse matrix.
7.4.5.2. igraphspmatrixnrow The number of rows in a sparse matrix.
7.4.5.3. igraphspmatrixncol The number of columns in a sparse matrix.
7.4.5.4. igraphspmatrixcountnonzero The number of nonzero elements in a sparse matrix.
7.4.5.5. igraphspmatrixmax Returns the maximum element of a matrix.
7.4.5.6. igraphspmatrixrowsums Calculates the row sums of the matrix.
7.4.5.7. igraphspmatrixcolsums Calculates the column sums of the matrix.
7.4.6. Matrix operations
7.4.6.1. igraphspmatrixscale Multiplies each element of the sparse matrix by a constant.
7.4.6.2. igraphspmatrixaddrows Adds rows to a sparse matrix.
7.4.6.3. igraphspmatrixaddcols Adds columns to a sparse matrix.
7.4.6.4. igraphspmatrixresize Resizes a sparse matrix.
7.4.7. Printing sparse matrices
7.4.7.1. igraphspmatrixprint Prints a sparse matrix.
7.4.7.2. igraphspmatrixfprint Prints a sparse matrix to the given file.
7.5. Sparse matrices, another kind
7.5.1. About sparse matrices
7.5.2. Creating sparse matrix objects
7.5.2.1. igraphsparsematinit Initialize a sparse matrix, in triplet format
7.5.2.2. igraphsparsematcopy Copy a sparse matrix
7.5.2.3. igraphsparsematrealloc Allocate more (or less) memory for a sparse matrix
7.5.2.4. igraphsparsematdestroy Deallocate memory used by a sparse matrix
7.5.2.5. igraphsparsemateye Create a sparse identity matrix
7.5.2.6. igraphsparsematdiag Create a sparse diagonal matrix
7.5.3. Query properties of a sparse matrix
7.5.3.1. igraphsparsematindex Index a sparse matrix, extract a submatrix, or a single element
7.5.3.2. igraphsparsematnrow Number of rows
7.5.3.3. igraphsparsematncol Number of columns.
7.5.3.4. igraphsparsemattype Type of a sparse matrix (triplet or columncompressed)
7.5.3.5. igraphsparsematistriplet Is this sparse matrix in triplet format?
7.5.3.6. igraphsparsematiscc Is this sparse matrix in columncompressed format?
7.5.4. Operations on sprase matrices
7.5.4.1. igraphsparsematentry Add an element to a sparse matrix
7.5.4.2. igraphsparsematfkeep Filter the elements of a sparse matrix
7.5.4.3. igraphsparsematdropzeros Drop the zero elements from a sparse matrix
7.5.4.4. igraphsparsematdroptol Drop the almost zero elements of a sparse matrix
7.5.4.5. igraphsparsematscale Scale a sparse matrix
7.5.4.6. igraphsparsematpermute Permute the rows and columns of a sparse matrix
7.5.4.7. igraphsparsemattranspose Transpose a sparse matrix
7.5.4.8. igraphsparsematadd Sum of two sparse matrices
7.5.4.9. igraphsparsematmultiply Matrix multiplication
7.5.4.10. igraphsparsematgaxpy Matrixvector product, added to another vector.
7.5.4.11. igraphsparsemataddrows Add rows to a sparse matrix
7.5.4.12. igraphsparsemataddcols Add columns to a sparse matrix
7.5.4.13. igraphsparsematresize Resize a sparse matrix
7.5.5. Operations that change the internal representation
7.5.5.1. igraphsparsematcompress Compress a sparse matrix, i.e. convert it to columncompress format
7.5.5.2. igraphsparsematdupl Remove duplicate elements from a sparse matrix
7.5.6. Decompositions and solving linear systems
7.5.6.1. igraphsparsematsymblu Symbolic LU decomposition
7.5.6.2. igraphsparsematsymbqr Symbolic QR decomposition
7.5.6.3. igraphsparsematlsolve Solve a lowertriangular linear system
7.5.6.4. igraphsparsematltsolve Solve an uppertriangular linear system
7.5.6.5. igraphsparsematusolve Solve an uppertriangular linear system
7.5.6.6. igraphsparsematutsolve Solve a lowertriangular linear system
7.5.6.7. igraphsparsematcholsol Solve a symmetric linear system via Cholesky decomposition
7.5.6.8. igraphsparsematlusol Solve a linear system via LU decomposition
7.5.6.9. igraphsparsematlu LU decomposition of a sparse matrix
7.5.6.10. igraphsparsematqr QR decomposition of a sparse matrix
7.5.6.11. igraphsparsematluresol Solve linear system using a precomputed LU decomposition
7.5.6.12. igraphsparsematqrresol Solve a linear system using a precomputed QR decomposition
7.5.6.13. igraphsparsematsymbolicdestroy Deallocate memory for a symbolic decomposition
7.5.6.14. igraphsparsematnumericdestroy Deallocate memory for a numeric decomposition
7.5.7. Eigenvalues and eigenvectors
7.5.7.1. igraphsparsematarpackrssolve Eigenvalues and eigenvectors of a symmetric sparse matrix via ARPACK
7.5.7.2. igraphsparsematarpackrnsolve Eigenvalues and eigenvectors of a nonsymmetric sparse matrix via ARPACK
7.5.8. Conversion to other data types
7.5.8.1. igraphsparsemat Create an igraph graph from a sparse matrix
7.5.8.2. igraphgetsparsemat Convert an igraph graph to a sparse matrix
7.5.8.3. igraphmatrixassparsemat Convert a dense matrix to a sparse matrix
7.5.8.4. igraphsparsematasmatrix Convert a sparse matrix to a dense matrix
7.5.9. Writing to a file, or to the screen
7.5.9.1. igraphsparsematprint Print a sparse matrix to a file
7.6. Stacks
7.6.1. igraphstackinit Initializes a stack.
7.6.2. igraphstackdestroy Destroys a stack object.
7.6.3. igraphstackreserve Reserve memory.
7.6.4. igraphstackempty Decides whether a stack object is empty.
7.6.5. igraphstacksize Returns the number of elements in a stack.
7.6.6. igraphstackclear Removes all elements from a stack.
7.6.7. igraphstackpush Places an element on the top of a stack.
7.6.8. igraphstackpop Removes and returns an element from the top of a stack.
7.6.9. igraphstacktop Query top element.
7.7. Doubleended queues
7.7.1. igraphdqueueinit Initialize a double ended queue (deque).
7.7.2. igraphdqueuedestroy Destroy a double ended queue.
7.7.3. igraphdqueueempty Decide whether the queue is empty.
7.7.4. igraphdqueuefull Check whether the queue is full.
7.7.5. igraphdqueueclear Remove all elements from the queue.
7.7.6. igraphdqueuesize Number of elements in the queue.
7.7.7. igraphdqueuehead Head of the queue.
7.7.8. igraphdqueueback Tail of the queue.
7.7.9. igraphdqueuepop Remove the head.
7.7.10. igraphdqueuepopback Remove the tail
7.7.11. igraphdqueuepush Appends an element.
7.8. Maximum and minimum heaps
7.8.1. igraphheapinit Initializes an empty heap object.
7.8.2. igraphheapinitarray Build a heap from an array.
7.8.3. igraphheapdestroy Destroys an initialized heap object.
7.8.4. igraphheapempty Decides whether a heap object is empty.
7.8.5. igraphheappush Add an element.
7.8.6. igraphheaptop Top element.
7.8.7. igraphheapdeletetop Return and removes the top element
7.8.8. igraphheapsize Number of elements
7.8.9. igraphheapreserve Allocate more memory
7.9. String vectors
7.9.1. igraphstrvectorinit Initialize
7.9.2. igraphstrvectorcopy Initialization by copying.
7.9.3. igraphstrvectordestroy Free allocated memory
7.9.4. STR Indexing string vectors
7.9.5. igraphstrvectorget Indexing
7.9.6. igraphstrvectorset Set an element
7.9.7. igraphstrvectorset2 Sets an element
7.9.8. igraphstrvectorremove Removes a single element from a string vector.
7.9.9. igraphstrvectorappend Concatenate two string vectors.
7.9.10. igraphstrvectorclear Remove all elements
7.9.11. igraphstrvectorresize Resize
7.9.12. igraphstrvectorsize Gives the size of a string vector.
7.9.13. igraphstrvectoradd Adds an element to the back of a string vector.
7.10. Adjacency lists
7.10.1. Adjacent vertices
7.10.1.1. igraphadjlistinit Initialize an adjacency list of vertices from a given graph
7.10.1.2. igraphadjlistinitempty Initialize an empty adjacency list
7.10.1.3. igraphadjlistinitcomplementer Adjacency lists for the complementer graph
7.10.1.4. igraphadjlistdestroy Deallocate memory
7.10.1.5. igraphadjlistget Query a vector in an adjlist
7.10.1.6. igraphadjlistsort Sort each vector in an adjacency list.
7.10.1.7. igraphadjlistsimplify Simplify
7.10.2. Incident edges
7.10.2.1. igraphinclistinit Initialize an incidence list of edges
7.10.2.2. igraphinclistdestroy Frees all memory allocated for an incidence list.
7.10.2.3. igraphinclistget Query a vector in an incidence list
7.10.3. Lazy adjacency list for vertices
7.10.3.1. igraphlazyadjlistinit Constructor
7.10.3.2. igraphlazyadjlistdestroy Deallocate memory
7.10.3.3. igraphlazyadjlistget Query neighbor vertices
7.10.4. Lazy incidence list for edges
7.10.4.1. igraphlazyinclistinit Initializes a lazy incidence list of edges
7.10.4.2. igraphlazyinclistdestroy Deallocates memory
7.10.4.3. igraphlazyinclistget Query incident edges
7.10.5. Deprecated functions
7.10.5.1. igraphadjedgelistinit Initialize an incidence list of edges
7.10.5.2. igraphadjedgelistdestroy Frees all memory allocated for an incidence list.
7.10.5.3. igraphadjedgelistget Query a vector in an incidence list
7.10.5.4. igraphlazyadjedgelistinit Initializes a lazy incidence list of edges
7.10.5.5. igraphlazyadjedgelistdestroy Frees all memory allocated for an incidence list.
7.10.5.6. igraphlazyadjedgelistget Query a vector in a lazy incidence list
Chapter 8. Random numbers
8.1. About random numbers in igraph, use cases
8.2. The default random number generator
8.2.1. igraphrngdefault Query the default random number generator.
8.2.2. igraphrngsetdefault Set the default igraph random number generator
8.3. Creating random number generators
8.3.1. igraphrnginit Initialize a random number generator
8.3.2. igraphrngdestroy Deallocate memory associated with a random number generator
8.3.3. igraphrngseed Set the seed of a random number generator
8.3.4. igraphrngmin Query the minimum possible integer for a random number generator
8.3.5. igraphrngmax Query the maximum possible integer for a random number generator
8.3.6. igraphrngname Query the type of a random number generator
8.4. Generating random numbers
8.4.1. igraphrnggetinteger Generate an integer random number from an interval
8.4.2. igraphrnggetunif Generate real, uniform random numbers from an interval
8.4.3. igraphrnggetunif01 Generate real, uniform random number from the unit interval
8.4.4. igraphrnggetnormal Normally distributed random numbers
8.4.5. igraphrnggetgeom Generate geometrically distributed random numbers
8.4.6. igraphrnggetbinom Generate binomially distributed random numbers
8.5. Supported random number generators
8.5.1. igraphrngtypemt19937 The MT19937 random number generator
8.5.2. igraphrngtypeglibc2 The random number generator type introduced in GNU libc 2
8.5.3. igraphrngtyperand The old BSD rand/stand random number generator
8.6. Use cases
8.6.1. Normal (default) use
8.6.2. Reproducible simulations
8.6.3. Changing the default generator
8.6.4. Using multiple generators
8.6.5. Example
Chapter 9. Graph Generators
9.1. Deterministic Graph Generators
9.1.1. igraphcreate Creates a graph with the specified edges.
9.1.2. igraphsmall Shorthand to create a short graph, giving the edges as arguments.
9.1.3. igraphadjacency Creates a graph object from an adjacency matrix.
9.1.4. igraphweightedadjacency Creates a graph object from a weighted adjacency matrix.
9.1.5. igraphadjlist Create a graph from an adjacency list
9.1.6. igraphstar Creates a star graph, every vertex connects only to the center.
9.1.7. igraphlattice Creates most kinds of lattices.
9.1.8. igraphring Creates a ring graph, a one dimensional lattice.
9.1.9. igraphtree Creates a tree in which almost all vertices have the same number of children.
9.1.10. igraphfull Creates a full graph (directed or undirected, with or without loops).
9.1.11. igraphfullcitation Creates a full citation graph
9.1.12. igraphfamous Create a famous graph by simply providing its name
9.1.13. igraphlcf Create a graph from LCF notation
9.1.14. igraphlcfvector Create a graph from LCF notation
9.1.15. igraphatlas Create a small graph from the Graph Atlas.
9.1.16. igraphdebruijn Generate a de Bruijn graph.
9.1.17. igraphkautz Generate a Kautz graph.
9.1.18. igraphextendedchordalring Create an extended chordal ring
9.1.19. igraphconnectneighborhood Connects every vertex to its neighborhood
9.2. Games: Randomized Graph Generators
9.2.1. igraphgrggame Generating geometric random graphs.
9.2.2. igraphbarabasigame Generates a graph based on the BarabásiAlbert model.
9.2.3. igrapherdosrenyigame Generates a random (ErdosRenyi) graph.
9.2.4. igraphwattsstrogatzgame The WattsStrogatz smallworld model
9.2.5. igraphrewireedges Rewire the edges of a graph with constant probability
9.2.6. igraphdegreesequencegame Generates a random graph with a given degree sequence
9.2.7. igraphstaticfitnessgame Generates a nongrowing random graph with edge probabilities
9.2.8. igraphstaticpowerlawgame Generates a nongrowing random graph with expected powerlaw degree distributions.
9.2.9. igraphforestfiregame Generates a network according to the forest fire game
9.2.10. igraphrewire Randomly rewires a graph while preserving the degree distribution.
9.2.11. igraphgrowingrandomgame Generates a growing random graph.
9.2.12. igraphcallawaytraitsgame Simulate a growing network with vertex types.
9.2.13. igraphestablishmentgame Generates a graph with a simple growing model with vertex types.
9.2.14. igraphpreferencegame Generates a graph with vertex types and connection preferences
9.2.15. igraphasymmetricpreferencegame Generates a graph with asymmetric vertex types and connection preferences
9.2.16. igraphrecentdegreegame Stochastic graph generator based on the number of incident edges a node has gained recently
9.2.17. igraphbarabasiaginggame Preferential attachment with aging of vertices
9.2.18. igraphrecentdegreeaginggame Preferential attachment based on the number of edges gained recently, with aging of vertices
9.2.19. igraphcitedtypegame Simulate a citation based on vertex types.
9.2.20. igraphcitingcitedtypegame Simulate a citation network based on vertex types.
Chapter 10. Games on Graphs
10.1. Microscopic Update Rules
10.1.1. igraphdeterministicoptimalimitation Adopt a strategy via deterministic optimal imitation.
10.1.2. igraphmoranprocess The Moran process in a network setting.
10.1.3. igraphroulettewheelimitation Adopt a strategy via roulette wheel selection.
10.1.4. igraphstochasticimitation Adopt a strategy via stochastic imitation with uniform selection.
Chapter 11. Vertex and Edge Selectors and Sequences, Iterators
11.1. About selectors, iterators
11.2. Vertex selector constructors
11.2.1. igraphvsall Vertex set, all vertices of a graph.
11.2.2. igraphvsadj Adjacent vertices of a vertex.
11.2.3. igraphvsnonadj Nonadjacent vertices of a vertex.
11.2.4. igraphvsnone Empty vertex set.
11.2.5. igraphvs1 Vertex set with a single vertex.
11.2.6. igraphvsvector Vertex set based on a vector.
11.2.7. igraphvsvectorsmall Create a vertex set by giving its elements.
11.2.8. igraphvsvectorcopy Vertex set based on a vector, with copying.
11.2.9. igraphvsseq Vertex set, an interval of vertices.
11.3. Generic vertex selector operations
11.3.1. igraphvscopy Creates a copy of a vertex selector.
11.3.2. igraphvsdestroy Destroy a vertex set.
11.3.3. igraphvsisall Check whether all vertices are included.
11.3.4. igraphvssize Returns the size of the vertex selector.
11.3.5. igraphvstype Returns the type of the vertex selector.
11.4. Immediate vertex selectors
11.4.1. igraphvssall All vertices of a graph (immediate version).
11.4.2. igraphvssnone Empty vertex set (immediate version).
11.4.3. igraphvss1 Vertex set with a single vertex (immediate version).
11.4.4. igraphvssvector Vertex set based on a vector (immediate version).
11.4.5. igraphvssseq An interval of vertices (immediate version).
11.5. Vertex iterators
11.5.1. igraphvitcreate Creates a vertex iterator from a vertex selector.
11.5.2. igraphvitdestroy Destroys a vertex iterator.
11.5.3. Stepping over the vertices
11.5.4. IGRAPHVITNEXT Next vertex.
11.5.5. IGRAPHVITEND Are we at the end?
11.5.6. IGRAPHVITSIZE Size of a vertex iterator.
11.5.7. IGRAPHVITRESET Reset a vertex iterator.
11.5.8. IGRAPHVITGET Query the current position.
11.6. Edge selector constructors
11.6.1. igraphesall Edge set, all edges.
11.6.2. igraphesincident Edges incident on a given vertex.
11.6.3. igraphesnone Empty edge selector.
11.6.4. igraphes1 Edge selector containing a single edge.
11.6.5. igraphesvector Handle a vector as an edge selector.
11.6.6. igraphesfromto Edge selector, all edges between two vertex sets.
11.6.7. igraphesseq Edge selector, a sequence of edge ids.
11.6.8. igraphespairs Edge selector, multiple edges defined by their endpoints in a vector.
11.6.9. igraphespairssmall Edge selector, multiple edges defined by their endpoints as arguments.
11.6.10. igraphesvectorcopy Edge set, based on a vector, with copying.
11.7. Immediate edge selectors
11.7.1. igraphessall Edge set, all edges (immediate version)
11.7.2. igraphessnone Immediate empty edge selector.
11.7.3. igraphess1 Immediate version of the single edge edge selector.
11.7.4. igraphessvector Immediate vector view edge selector.
11.7.5. igraphessseq Immediate version of the sequence edge selector.
11.8. Generic edge selector operations
11.8.1. igraphescopy Creates a copy of an edge selector.
11.8.2. igraphesdestroy Destroys an edge selector object.
11.8.3. igraphesisall Check whether an edge selector includes all edges.
11.8.4. igraphessize Returns the size of the edge selector.
11.8.5. igraphestype Returns the type of the edge selector.
11.9. Edge iterators
11.9.1. igrapheitcreate Creates an edge iterator from an edge selector.
11.9.2. igrapheitdestroy Destroys an edge iterator.
11.9.3. Stepping over the edges
11.9.4. IGRAPHEITNEXT Next edge.
11.9.5. IGRAPHEITEND Are we at the end?
11.9.6. IGRAPHEITSIZE Number of edges in the iterator.
11.9.7. IGRAPHEITRESET Reset an edge iterator.
11.9.8. IGRAPHEITGET Query an edge iterator.
Chapter 12. Graph, Vertex and Edge Attributes
12.1. The Attribute Handler Interface
12.1.1. igraphattributetablet Table of functions to perform operations on attributes
12.1.2. igraphisetattributetable Attach an attribute table.
12.1.3. igraphattributetypet The possible types of the attributes.
12.2. Accessing attributes from C
12.2.1. Query attributes
12.2.1.1. igraphcattributelist List all attributes
12.2.1.2. igraphcattributehasattr Checks whether a (graph, vertex or edge) attribute exists
12.2.1.3. igraphcattributeGAN Query a numeric graph attribute.
12.2.1.4. GAN Query a numeric graph attribute.
12.2.1.5. igraphcattributeGAS Query a string graph attribute.
12.2.1.6. GAS Query a string graph attribute.
12.2.1.7. igraphcattributeVAN Query a numeric vertex attribute.
12.2.1.8. VAN Query a numeric vertex attribute.
12.2.1.9. igraphcattributeVANV Query a numeric vertex attribute for many vertices
12.2.1.10. VANV Query a numeric vertex attribute for all vertices.
12.2.1.11. igraphcattributeVAS Query a string vertex attribute.
12.2.1.12. VAS Query a string vertex attribute.
12.2.1.13. igraphcattributeVASV Query a string vertex attribute for many vertices
12.2.1.14. VASV Query a string vertex attribute for all vertices.
12.2.1.15. igraphcattributeEAN Query a numeric edge attribute.
12.2.1.16. EAN Query a numeric edge attribute.
12.2.1.17. igraphcattributeEANV Query a numeric edge attribute for many edges
12.2.1.18. EANV Query a numeric edge attribute for all edges.
12.2.1.19. igraphcattributeEAS Query a string edge attribute.
12.2.1.20. EAS Query a string edge attribute.
12.2.1.21. igraphcattributeEASV Query a string edge attribute for many edges
12.2.1.22. EASV Query a string edge attribute for all edges.
12.2.2. Set attributes
12.2.2.1. igraphcattributeGANset Set a numeric graph attribute
12.2.2.2. SETGAN Set a numeric graph attribute
12.2.2.3. igraphcattributeGASset Set a string graph attribute.
12.2.2.4. SETGAS Set a string graph attribute
12.2.2.5. igraphcattributeVANset Set a numeric vertex attribute
12.2.2.6. SETVAN Set a numeric vertex attribute
12.2.2.7. igraphcattributeVASset Set a string vertex attribute
12.2.2.8. SETVAS Set a string vertex attribute
12.2.2.9. igraphcattributeEANset Set a numeric edge attribute
12.2.2.10. SETEAN Set a numeric edge attribute
12.2.2.11. igraphcattributeEASset Set a string edge attribute
12.2.2.12. SETEAS Set a string edge attribute
12.2.2.13. igraphcattributeVANsetv Set a numeric vertex attribute for all vertices.
12.2.2.14. SETVANV Set a numeric vertex attribute for all vertices
12.2.2.15. igraphcattributeVASsetv Set a string vertex attribute for all vertices.
12.2.2.16. SETVASV Set a string vertex attribute for all vertices
12.2.2.17. igraphcattributeEANsetv Set a numeric edge attribute for all vertices.
12.2.2.18. SETEANV Set a numeric edge attribute for all vertices
12.2.2.19. igraphcattributeEASsetv Set a string edge attribute for all vertices.
12.2.2.20. SETEASV Set a string edge attribute for all vertices
12.2.3. Remove attributes
12.2.3.1. igraphcattributeremoveg Remove a graph attribute
12.2.3.2. DELGA Remove a graph attribute.
12.2.3.3. igraphcattributeremovev Remove a vertex attribute
12.2.3.4. DELVA Remove a vertex attribute.
12.2.3.5. igraphcattributeremovee Remove an edge attribute
12.2.3.6. DELEA Remove an edge attribute.
12.2.3.7. igraphcattributeremoveall Remove all graph/vertex/edge attributes
12.2.3.8. DELGAS Remove all graph attributes.
12.2.3.9. DELVAS Remove all vertex attributes.
12.2.3.10. DELEAS Remove all edge attributes.
12.2.3.11. DELALL Remove all attributes.
Chapter 13. Structural Properties of Graphs
13.1. Basic Properties
13.1.1. igraphareconnected Decides whether two vertices are connected
13.2. Shortest Path Related Functions
13.2.1. igraphshortestpaths The length of the shortest paths between vertices.
13.2.2. igraphshortestpathsdijkstra Weighted shortest paths from some sources.
13.2.3. igraphshortestpathsbellmanford Weighted shortest paths from some sources allowing negative weights.
13.2.4. igraphshortestpathsjohnson Calculate shortest paths from some sources using Johnson's algorithm.
13.2.5. igraphgetshortestpaths Calculates the shortest paths from/to one vertex.
13.2.6. igraphgetshortestpath Shortest path from one vertex to another one.
13.2.7. igraphgetshortestpathsdijkstra Calculates the weighted shortest paths from/to one vertex.
13.2.8. igraphgetshortestpathdijkstra Weighted shortest path from one vertex to another one.
13.2.9. igraphgetallshortestpaths Finds all shortest paths (geodesics) from a vertex to all other vertices.
13.2.10. igraphgetallshortestpathsdijkstra Finds all shortest paths (geodesics) from a vertex to all other vertices.
13.2.11. igraphaveragepathlength Calculates the average geodesic length in a graph.
13.2.12. igraphpathlengthhist Create a histogram of all shortest path lengths.
13.2.13. igraphdiameter Calculates the diameter of a graph (longest geodesic).
13.2.14. igraphdiameterdijkstra Weighted diameter using Dijkstra's algorithm, nonnegative weights only.
13.2.15. igraphgirth The girth of a graph is the length of the shortest circle in it.
13.2.16. igrapheccentricity Eccentricity of some vertices
13.2.17. igraphradius Radius of a graph
13.3. Neighborhood of a vertex
13.3.1. igraphneighborhoodsize Calculates the size of the neighborhood of a given vertex.
13.3.2. igraphneighborhood Calculate the neighborhood of vertices.
13.3.3. igraphneighborhoodgraphs Create graphs from the neighborhood(s) of some vertex/vertices.
13.4. Graph Components
13.4.1. igraphsubcomponent The vertices in the same component as a given vertex.
13.4.2. igraphinducedsubgraph Creates a subgraph induced by the specified vertices.
13.4.3. igraphsubgraphedges Creates a subgraph with the specified edges and their endpoints.
13.4.4. igraphsubgraph Creates a subgraph induced by the specified vertices.
13.4.5. igraphclusters Calculates the (weakly or strongly) connected components in a graph.
13.4.6. igraphisconnected Decides whether the graph is (weakly or strongly) connected.
13.4.7. igraphdecompose Decompose a graph into connected components.
13.4.8. igraphdecomposedestroy Free the memory allocated by igraphdecompose().
13.4.9. igraphbiconnectedcomponents Calculate biconnected components
13.4.10. igrapharticulationpoints Find the articulation points in a graph.
13.5. Centrality Measures
13.5.1. igraphcloseness Closeness centrality calculations for some vertices.
13.5.2. igraphbetweenness Betweenness centrality of some vertices.
13.5.3. igraphedgebetweenness Betweenness centrality of the edges.
13.5.4. igraphpagerank Calculates the Google PageRank for the specified vertices.
13.5.5. igraphpagerankold Calculates the Google PageRank for the specified vertices.
13.5.6. igraphpersonalizedpagerank Calculates the personalized Google PageRank for the specified vertices.
13.5.7. igraphpersonalizedpagerankvs Calculates the personalized Google PageRank for the specified vertices.
13.5.8. igraphconstraint Burt's constraint scores.
13.5.9. igraphmaxdegree Calculate the maximum degree in a graph (or set of vertices).
13.5.10. igraphstrength Strength of the vertices, weighted vertex degree in other words.
13.5.11. igrapheigenvectorcentrality Eigenvector centrality of the vertices
13.5.12. igraphhubscore Kleinberg's hub scores
13.5.13. igraphauthorityscore Kleinerg's authority scores
13.6. Estimating Centrality Measures
13.6.1. igraphclosenessestimate Closeness centrality estimations for some vertices.
13.6.2. igraphbetweennessestimate Estimated betweenness centrality of some vertices.
13.6.3. igraphedgebetweennessestimate Estimated betweenness centrality of the edges.
13.7. Centralization
13.7.1. igraphcentralization Calculate the centralization score from the node level scores
13.7.2. igraphcentralizationdegree Calculate vertex degree and graph centralization
13.7.3. igraphcentralizationbetweenness Calculate vertex betweenness and graph centralization
13.7.4. igraphcentralizationcloseness Calculate vertex closeness and graph centralization
13.7.5. igraphcentralizationeigenvectorcentrality Calculate eigenvector centrality scores and graph centralization
13.7.6. igraphcentralizationdegreetmax Theoretical maximum for graph centralization based on degree
13.7.7. igraphcentralizationbetweennesstmax Theoretical maximum for graph centralization based on betweenness
13.7.8. igraphcentralizationclosenesstmax Theoretical maximum for graph centralization based on closeness
13.7.9. igraphcentralizationeigenvectorcentralitytmax Theoretical maximum centralization for eigenvector centrality
13.8. Similarity Measures
13.8.1. igraphbibcoupling Bibliographic coupling.
13.8.2. igraphcocitation Cocitation coupling.
13.8.3. igraphsimilarityjaccard Jaccard similarity coefficient for the given vertices.
13.8.4. igraphsimilarityjaccardpairs Jaccard similarity coefficient for given vertex pairs.
13.8.5. igraphsimilarityjaccardes Jaccard similarity coefficient for a given edge selector.
13.8.6. igraphsimilaritydice Dice similarity coefficient.
13.8.7. igraphsimilaritydicepairs Dice similarity coefficient for given vertex pairs.
13.8.8. igraphsimilaritydicees Dice similarity coefficient for a given edge selector.
13.8.9. igraphsimilarityinverselogweighted Vertex similarity based on the inverse logarithm of vertex degrees.
13.9. Spanning Trees
13.9.1. igraphminimumspanningtree Calculates one minimum spanning tree of a graph.
13.9.2. igraphminimumspanningtreeunweighted Calculates one minimum spanning tree of an unweighted graph.
13.9.3. igraphminimumspanningtreeprim Calculates one minimum spanning tree of a weighted graph.
13.10. Transitivity or Clustering Coefficient
13.10.1. igraphtransitivityundirected Calculates the transitivity (clustering coefficient) of a graph.
13.10.2. igraphtransitivitylocalundirected Calculates the local transitivity (clustering coefficient) of a graph.
13.10.3. igraphtransitivityavglocalundirected Average local transitivity (clustering coefficient).
13.10.4. igraphtransitivitybarrat Weighted transitivity, as defined by A. Barrat.
13.11. Directedness conversion
13.11.1. igraphtodirected Convert an undirected graph to a directed one
13.11.2. igraphtoundirected Convert a directed graph to an undirected one.
13.12. Spectral properties
13.12.1. igraphlaplacian Returns the Laplacian matrix of a graph
13.13. Nonsimple graphs: multiple and loop edges
13.13.1. igraphissimple Decides whether the input graph is a simple graph.
13.13.2. igraphisloop Find the loop edges in a graph.
13.13.3. igraphismultiple Find the multiple edges in a graph.
13.13.4. igraphhasmultiple Check whether the graph has at least one multiple edge.
13.13.5. igraphcountmultiple Count the number of appearances of the edges in a graph.
13.13.6. igraphsimplify Removes loop and/or multiple edges from the graph.
13.14. Mixing patterns
13.14.1. igraphassortativitynominal Assortativity of a graph based on vertex categories
13.14.2. igraphassortativity Assortativity based on numeric properties of vertices
13.14.3. igraphassortativitydegree Assortativity of a graph based on vertex degree
13.15. KCores
13.15.1. igraphcoreness Finding the coreness of the vertices in a network.
13.16. Topological sorting, directed acyclic graphs
13.16.1. igraphisdag Checks whether a graph is a directed acyclic graph (DAG) or not.
13.16.2. igraphtopologicalsorting Calculate a possible topological sorting of the graph.
13.16.3. igraphfeedbackarcset Calculates a feedback arc set of the graph using different
13.17. Maximum cardinality search, graph decomposition, chordal graphs
13.17.1. igraphmaximumcardinalitysearch Maximum cardinality search
13.17.2. igraphischordal Decides whether a graph is chordal
13.18. Matchings
13.18.1. igraphismatching Checks whether the given matching is valid for the given graph.
13.18.2. igraphismaximalmatching Checks whether a matching in a graph is maximal.
13.18.3. igraphmaximumbipartitematching Calculates a maximum matching in a bipartite graph.
13.19. Line graphs
13.19.1. igraphlinegraph Create the line graph of a graph.
13.20. Unfolding a graph into a tree
13.20.1. igraphunfoldtree Unfolding a graph into a tree, by possibly multiplicating its vertices.
13.21. Other Operations
13.21.1. igraphdensity Calculate the density of a graph.
13.21.2. igraphreciprocity Calculates the reciprocity of a directed graph.
13.21.3. igraphdiversity Structural diversity index of the vertices
13.21.4. igraphismutual Check whether the edges of a directed graph are mutual.
13.21.5. igraphavgnearestneighbordegree Average nearest neighbor degree.
13.21.6. igraphgetadjacency Returns the adjacency matrix of a graph
13.21.7. igraphgetstochastic Stochastic adjacency matrix of a graph
13.21.8. igraphgetstochasticsparsemat Stochastic adjacency matrix of a graph
13.21.9. igraphgetedgelist Returns the list of edges in a graph
13.21.10. igraphcontractvertices Replace multiple vertices with a single one.
Chapter 14. Graph visitors
14.1. Breadthfirst search
14.1.1. igraphbfs Breadthfirst search
14.1.2. igraphbfshandlert Callback type for BFS function
14.2. Depthfirst search
14.2.1. igraphdfs Depthfirst search
14.2.2. igraphdfshandlert Callback type for the DFS function
Chapter 15. Cliques and Independent Vertex Sets
15.1. Cliques
15.1.1. igraphcliques Find all or some cliques in a graph
15.1.2. igraphlargestcliques Finds the largest clique(s) in a graph.
15.1.3. igraphmaximalcliques Find all maximal cliques of a graph
15.1.4. igraphcliquenumber Find the clique number of the graph
15.2. Independent Vertex Sets
15.2.1. igraphindependentvertexsets Find all independent vertex sets in a graph
15.2.2. igraphlargestindependentvertexsets Finds the largest independent vertex set(s) in a graph.
15.2.3. igraphmaximalindependentvertexsets Find all maximal independent vertex sets of a graph
15.2.4. igraphindependencenumber Find the independence number of the graph
Chapter 16. Graph Isomorphism
16.1. The simple interface
16.1.1. igraphpermutevertices Permute the vertices
16.1.2. igraphisomorphic Decides whether two graphs are isomorphic
16.1.3. igraphsubisomorphic Decide subgraph isomorphism
16.2. The BLISS algorithm
16.2.1. igraphblisssht Splitting heuristics for BLISS
16.2.2. igraphblissinfot Information about a BLISS run
16.2.3. igraphcanonicalpermutation Canonical permutation using BLISS
16.2.4. igraphisomorphicbliss Graph isomorphism via BLISS
16.2.5. igraphautomorphisms Number of automorphisms using BLISS
16.3. The VF2 algorithm
16.3.1. igraphisomorphicvf2 Isomorphism via VF2
16.3.2. igraphcountisomorphismsvf2 Number of isomorphisms via VF2
16.3.3. igraphgetisomorphismsvf2 Collect the isomorphic mappings
16.3.4. igraphisohandlert Callback type, called when an isomorphism was found
16.3.5. igraphisocompatt Callback type, called to check whether two vertices or edges are compatible
16.3.6. igraphisomorphicfunctionvf2 The generic VF2 interface
16.3.7. igraphsubisomorphicvf2 Decide subgraph isomorphism using VF2
16.3.8. igraphcountsubisomorphismsvf2 Number of subgraph isomorphisms using VF2
16.3.9. igraphgetsubisomorphismsvf2 Return all subgraph isomorphic mappings
16.3.10. igraphsubisomorphicfunctionvf2 Generic VF2 function for subgraph isomorphism problems
16.4. Functions for graphs with 3 or 4 vertices
16.4.1. igraphisomorphic34 Graph isomorphism for 34 vertices
16.4.2. igraphisoclass Determine the isomorphism class of a graph with 3 or 4 vertices
16.4.3. igraphisoclasssubgraph The isomorphism class of a subgraph of a graph.
16.4.4. igraphisoclasscreate Creates a graph from the given isomorphism class.
Chapter 17. Graph Motifs, Dyad Census and Triad Census
17.1. igraphdyadcensus Calculating the dyad census as defined by Holland and Leinhardt
17.2. igraphtriadcensus Triad census, as defined by Davis and Leinhardt
17.3. Graph motifs
17.3.1. igraphmotifsrandesu Count the number of motifs in a graph
17.3.2. igraphmotifsrandesuno Count the total number of motifs in a graph
17.3.3. igraphmotifsrandesuestimate Estimate the total number of motifs in a graph
17.3.4. igraphmotifsrandesucallback Finds motifs in a graph and calls a function for each of them
17.3.5. igraphmotifshandlert Callback type for igraphmotifsrandesucallback
Chapter 18. Generating Layouts for Graph Drawing
18.1. 2D layout generators
18.1.1. igraphlayoutrandom Places the vertices uniform randomly on a plane.
18.1.2. igraphlayoutcircle Places the vertices uniformly on a circle, in the order of vertex ids.
18.1.3. igraphlayoutstar Generate a starlike layout
18.1.4. igraphlayoutgrid Places the vertices on a regular grid on the plane.
18.1.5. igraphlayoutgraphopt Optimizes vertex layout via the graphopt algorithm.
18.1.6. The DrL layout generator
18.1.6.1. igraphlayoutdrloptionst Parameters for the DrL layout generator
18.1.6.2. igraphlayoutdrldefaultt Predefined parameter templates for the DrL layout generator
18.1.6.3. igraphlayoutdrloptionsinit Initialize parameters for the DrL layout generator
18.1.6.4. igraphlayoutdrl The DrL layout generator
18.1.6.5. igraphlayoutdrl3d The DrL layout generator, 3d version.
18.1.7. igraphlayoutfruchtermanreingold Places the vertices on a plane according to the FruchtermanReingold algorithm.
18.1.8. igraphlayoutkamadakawai Places the vertices on a plane according the KamadaKawai algorithm.
18.1.9. igraphlayoutmds Place the vertices on a plane using multidimensional scaling.
18.1.10. igraphlayoutgridfruchtermanreingold Force based layout generator for large graphs.
18.1.11. igraphlayoutlgl Force based layout algorithm for large graphs.
18.1.12. igraphlayoutreingoldtilford ReingoldTilford layout for tree graphs
18.1.13. igraphlayoutreingoldtilfordcircular Circular ReingoldTilford layout for trees
18.1.14. igraphlayoutsugiyama Sugiyama layout algorithm for layered directed acyclic graphs.
18.2. 3D layout generators
18.2.1. igraphlayoutrandom3d Random layout in 3D
18.2.2. igraphlayoutsphere Places vertices (more or less) uniformly on a sphere.
18.2.3. igraphlayoutgrid3d Places the vertices on a regular grid in the 3D space.
18.2.4. igraphlayoutfruchtermanreingold3d 3D FruchtermanReingold algorithm.
18.2.5. igraphlayoutkamadakawai3d 3D version of the force based KamadaKawai layout.
18.3. Merging layouts
18.3.1. igraphlayoutmergedla Merge multiple layouts by using a DLA algorithm
Chapter 19. Reading and Writing Graphs from and to Files
19.1. Simple edge list and similar formats
19.1.1. igraphreadgraphedgelist Reads an edge list from a file and creates a graph.
19.1.2. igraphwritegraphedgelist Writes the edge list of a graph to a file.
19.1.3. igraphreadgraphncol Reads a .ncol file used by LGL.
19.1.4. igraphwritegraphncol Writes the graph to a file in .ncol format
19.1.5. igraphreadgraphlgl Reads a graph from an .lgl file
19.1.6. igraphwritegraphlgl Writes the graph to a file in .lgl format
19.1.7. igraphreadgraphdimacs Read a graph in DIMACS format.
19.1.8. igraphwritegraphdimacs Write a graph in DIMACS format.
19.2. Binary formats
19.2.1. igraphreadgraphgraphdb Read a graph in the binary graph database format.
19.3. GraphML format
19.3.1. igraphreadgraphgraphml Reads a graph from a GraphML file.
19.3.2. igraphwritegraphgraphml Writes the graph to a file in GraphML format
19.4. GML format
19.4.1. igraphreadgraphgml Read a graph in GML format.
19.4.2. igraphwritegraphgml Write the graph to a stream in GML format
19.5. Pajek format
19.5.1. igraphreadgraphpajek Reads a file in Pajek format
19.5.2. igraphwritegraphpajek Writes a graph to a file in Pajek format.
19.6. UCINET's DL file format
19.6.1. igraphreadgraphdl Read a file in the DL format of UCINET
19.7. Graphviz format
19.7.1. igraphwritegraphdot Write the graph to a stream in DOT format
Chapter 20. Maximum Flows, Minimum Cuts and related measures
20.1. Maximum Flows
20.1.1. igraphmaxflow Maximum network flow between a pair of vertices
20.1.2. igraphmaxflowvalue Maximum flow in a network with the push/relabel algorithm
20.1.3. igraphdominatortree Calculates the dominator tree of a flowgraph
20.2. Cuts and minimum cuts
20.2.1. igraphstmincut Minimum cut between a source and a target vertex
20.2.2. igraphstmincutvalue The minimum st cut in a graph
20.2.3. igraphallstcuts List all edgecuts between two vertices in a directed graph
20.2.4. igraphallstmincuts All minimum st cuts of a directed graph
20.2.5. igraphmincut Calculates the minimum cut in a graph.
20.2.6. igraphmincutvalue The minimum edge cut in a graph
20.3. Connectivity
20.3.1. igraphstedgeconnectivity Edge connectivity of a pair of vertices
20.3.2. igraphedgeconnectivity The minimum edge connectivity in a graph.
20.3.3. igraphstvertexconnectivity The vertex connectivity of a pair of vertices
20.3.4. igraphvertexconnectivity The vertex connectivity of a graph
20.4. Edge and VertexDisjoint Paths
20.4.1. igraphedgedisjointpaths The maximum number of edgedisjoint paths between two vertices.
20.4.2. igraphvertexdisjointpaths Maximum number of vertexdisjoint paths between two vertices.
20.5. Graph Adhesion and Cohesion
20.5.1. igraphadhesion Graph adhesion, this is (almost) the same as edge connectivity.
20.5.2. igraphcohesion Graph cohesion, this is the same as vertex connectivity.
20.6. Cohesive Blocks
20.6.1. igraphcohesiveblocks Identifies the hierarchical cohesive block structure of a graph
Chapter 21. Vertex separators
21.1. igraphisseparator Decides whether the removal of a set of vertices disconnects the graph
21.2. igraphisminimalseparator Decides whether a set of vertices is a minimal separator
21.3. igraphallminimalstseparators List all vertex sets that are minimal (s,t) separators for some s and t
21.4. igraphminimumsizeseparators Find all minimum size separating vertex sets
Chapter 22. Detecting Community Structure
22.1. Common functions related to community structure
22.1.1. igraphmodularity Calculate the modularity of a graph with respect to some vertex types
22.1.2. igraphcommunityoptimalmodularity Calculate the community structure with the highest modularity value
22.1.3. igraphcommunitytomembership Create membership vector from community structure dendrogram
22.1.4. igraphreindexmembership Makes the IDs in a membership vector continuous
22.1.5. igraphcomparecommunities Compares community structures using various metrics
22.1.6. igraphsplitjoindistance Calculates the splitjoin distance of two community structures
22.2. Community structure based on statistical mechanics
22.2.1. igraphcommunityspinglass Community detection based on statistical mechanics
22.2.2. igraphcommunityspinglasssingle Community of a single node based on statistical mechanics
22.3. Community structure based on eigenvectors of matrices
22.3.1. igraphcommunityleadingeigenvector Leading eigenvector community finding (proper version).
22.3.2. igraphcommunityleadingeigenvectorcallbackt Callback for the leading eigenvector community finding method.
22.3.3. igraphlecommunitytomembership Vertex membership from the leading eigenvector community structure
22.4. Walktrap: community structure based on random walks
22.4.1. igraphcommunitywalktrap This function is the implementation of the Walktrap community
22.5. Edge betweenness based community detection
22.5.1. igraphcommunityedgebetweenness Community finding based on edge betweenness
22.5.2. igraphcommunityebgetmerges Calculating the merges, ie. the dendrogram for an edge betweenness community structure
22.6. Community structure based on the optimization of modularity
22.6.1. igraphcommunityfastgreedy Finding community structure by greedy optimization of modularity
22.6.2. igraphcommunitymultilevel Finding community structure by multilevel optimization of modularity
22.7. Label propagation
22.7.1. igraphcommunitylabelpropagation Community detection based on label propagation
22.8. The InfoMAP algorithm
22.8.1. igraphcommunityinfomap Find community structure that minimizes the expected
Chapter 23. Hierarchical random graphs
23.1. Introduction
23.2. Representing HRGs
23.2.1. igraphhrgt Data structure to store a hierarchical random graph
23.2.2. igraphhrginit Allocate memory for a HRG.
23.2.3. igraphhrgdestroy Deallocate memory for an HRG.
23.2.4. igraphhrgsize Returns the size of the HRG, the number of leaf nodes.
23.2.5. igraphhrgresize Resize a HRG.
23.3. Fitting HRGs
23.3.1. igraphhrgfit Fit a hierarchical random graph model to a network
23.3.2. igraphhrgconsensus Calculate a consensus tree for a HRG.
23.4. HRG sampling
23.4.1. igraphhrgsample Sample from a hierarchical random graph model
23.4.2. igraphhrggame Generate a hierarchical random graph
23.5. Conversion to and from igraph graphs
23.5.1. igraphhrgdendrogram Create a dendrogram from a hierarchical random graph.
23.5.2. igraphhrgcreate Create a HRG from an igraph graph.
23.6. Predicting missing edges
23.6.1. igraphhrgpredict Predict missing edges in a graph, based on HRG models
Chapter 24. Spectral Coarse Graining
24.1. Introduction
24.1.1. SCG in brief
24.1.2. Functions for performing SCG
24.1.3. References
24.2. SCG functions
24.2.1. igraphscgadjacency Spectral coarse graining, symmetric case.
24.2.2. igraphscgstochastic Spectral coarse graining, stochastic case.
24.2.3. igraphscglaplacian Spectral coarse graining, laplacian matrix.
24.2.4. igraphscggrouping SCG problem solver
24.2.5. igraphscgsemiprojectors Compute SCG semiprojectors for a given partition
24.2.6. igraphscgnormeps Calculate SCG residuals
Chapter 25. Graph Operators
25.1. Union and intersection
25.1.1. igraphdisjointunion Creates the union of two disjoint graphs
25.1.2. igraphdisjointunionmany The disjint union of many graphs.
25.1.3. igraphunion Calculates the union of two graphs.
25.1.4. igraphunionmany Creates the union of many graphs.
25.1.5. igraphintersection Collect the common edges from two graphs.
25.1.6. igraphintersectionmany The intersection of more than two graphs.
25.2. Other setlike operators
25.2.1. igraphdifference Calculate the difference of two graphs
25.2.2. igraphcomplementer Create the complementer of a graph
25.2.3. igraphcompose Calculates the composition of two graphs
Chapter 26. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs
26.1. BLAS interface in igraph
26.1.1. igraphblasdgemv Matrixvector multiplication using BLAS, vector version.
26.1.2. igraphblasdgemvarray Matrixvector multiplication using BLAS, array version.
26.2. LAPACK interface in igraph
26.2.1. Matrix factorization, solving linear systems
26.2.1.1. igraphlapackdgetrf LU factorization of a general MbyN matrix
26.2.1.2. igraphlapackdgetrs Solve general system of linear equations using LU factorization
26.2.1.3. igraphlapackdgesv Solve system of linear equations with LU factorization
26.2.2. Eigenvalues and eigenvectors of matrices
26.2.2.1. igraphlapackdsyevr Selected eigenvalues and optionally eigenvectors of a symmetric matrix
26.2.2.2. igraphlapackdgeev Eigenvalues and optionally eigenvectors of a nonsymmetric matrix
26.2.2.3. igraphlapackdgeevx Eigenvalues/vectors of nonsymmetric matrices, expert mode
26.3. ARPACK interface in igraph
26.3.1. Data structures
26.3.1.1. igrapharpackoptionst Options for ARPACK
26.3.1.2. igrapharpackstoraget Storage for ARPACK
26.3.1.3. igrapharpackfunctiont Type of the ARPACK callback function
26.3.1.4. igrapharpackoptionsinit Initialize ARPACK options
26.3.1.5. igrapharpackstorageinit Initialize ARPACK storage
26.3.1.6. igrapharpackstoragedestroy Deallocate ARPACK storage
26.3.2. ARPACK solvers
26.3.2.1. igrapharpackrssolve ARPACK solver for symmetric matrices
26.3.2.2. igrapharpackrnsolve ARPACK solver for nonsymmetric matrices
26.3.2.3. igrapharpackunpackcomplex Make the result of the nonsymmetric ARPACK solver more readable
Chapter 27. Bipartite, i.e. twomode graphs
27.1. Bipartite networks in igraph
27.2. Create twomode networks
27.2.1. igraphcreatebipartite Create a bipartite graph
27.2.2. igraphfullbipartite Create a full bipartite network
27.3. Incidence matrices
27.3.1. igraphincidence Create a bipartite graph from an incidence matrix
27.3.2. igraphgetincidence Convert a bipartite graph into an incidence matrix
27.4. Project a twomode graphs
27.4.1. igraphbipartiteprojectionsize Calculate the number of vertices and edges in the bipartite projections
27.4.2. igraphbipartiteprojection Create one or both projections of a bipartite (twomode) network
27.5. Other operations on bipartite graphs
27.5.1. igraphisbipartite Check whether a graph is bipartite
Chapter 28. Advenced igraph programming
28.1. Using igraph in multithreaded programs
28.1.1. IGRAPHTHREADSAFE Macro that is defined to be 1 if the current build of the
28.1.2. Threadsafe ARPACK library
28.2. Progress handlers
28.2.1. About progress handlers
28.2.2. Setting up progress handlers
28.2.2.1. igraphprogresshandlert Type of progress handler functions
28.2.2.2. igraphsetprogresshandler Install a progress handler, or remove the current handler
28.2.2.3. igraphprogresshandlerstderr A simple predefined progress handler
28.2.3. Invoking the progress handler
28.2.3.1. IGRAPHPROGRESS Report progress.
28.2.3.2. igraphprogress Report progress
28.2.3.3. igraphprogressf Report progress, printflike version
28.2.4. Writing progress handlers
28.2.5. Writing igraph functions with progress reporting
28.2.6. Multithreaded programs
28.3. Status handlers
28.3.1. Status reporting
28.3.2. Setting up status handlers
28.3.2.1. igraphstatushandlert The type of the igraph status handler functions
28.3.2.2. igraphsetstatushandler Install of uninstall a status handler function.
28.3.2.3. igraphstatushandlerstderr A simple predefined status handler function.
28.3.3. Invoking the status handler
28.3.3.1. IGRAPHSTATUS Report the status of an igraph function.
28.3.3.2. IGRAPHSTATUSF Report the status from an igraph function
28.3.3.3. igraphstatus Report status from an igraph function.
28.3.3.4. igraphstatusf Report status, more flexible printflike version.
Chapter 29. Not Graph Related Functions
29.1. Igraph version number
29.1.1. igraphversion Return the version of the igraph C library
29.2. Running Mean of a Time Series
29.2.1. igraphrunningmean Calculates the running mean of a vector.
29.3. Random Sampling from Very Long Sequences
29.3.1. igraphrandomsample Generates an increasing random sequence of integers.
29.4. Convex hull of a set of points on a plane
29.4.1. igraphconvexhull Determines the convex hull of a given set of points in the 2D plane
Chapter 30. Licenses for igraph and this manual
30.1. THE GNU GENERAL PUBLIC LICENSE
30.1.1. Preamble
30.1.2. GNU GENERAL PUBLIC LICENSE
30.1.3. How to Apply These Terms to Your New Programs
30.2. The GNU Free Documentation License
30.2.1. 0. PREAMBLE
30.2.2. 1. APPLICABILITY AND DEFINITIONS
30.2.3. 2. VERBATIM COPYING
30.2.4. 3. COPYING IN QUANTITY
30.2.5. 4. MODIFICATIONS
30.2.6. 5. COMBINING DOCUMENTS
30.2.7. 6. COLLECTIONS OF DOCUMENTS
30.2.8. 7. AGGREGATION WITH INDEPENDENT WORKS
30.2.9. 8. TRANSLATION
30.2.10. 9. TERMINATION
30.2.11. 10. FUTURE REVISIONS OF THIS LICENSE
30.2.12. G.1.1 ADDENDUM: How to use this License for your documents
Index
igraph Reference Manual Gábor Csárdi Department of Statistics, Harvard University 1 Oxford street, Cambridge, MA, 02138 USA Tamás Nepusz Department of Biological Physics, Eötvös University 1/a Pázmány Péter sétány, 1117 Budapest, Hungary
igraph Reference Manual by Gábor Csárdi and Tamás Nepusz Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Gábor Csárdi and Tamás Nepusz. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.
Table of Contents 1. Introduction............................................................................................................................................1 1.1. igraph is free software.................................................................................................................1 1.2. Citing igraph ...............................................................................................................................2 2. Installation..............................................................................................................................................3 3. Tutorial ...................................................................................................................................................5 3.1. Lesson 1. Compiling programs using igraph. .............................................................................5 3.2. Lesson 2. Creating your first graphs. ..........................................................................................6 3.3. Lesson 3. Calculating various properties of graphs. ...................................................................8 4. About igraph graphs, the basic interface ..........................................................................................10 4.1. The igraph data model...............................................................................................................10 4.2. The basic interface ....................................................................................................................11 4.2.1. Graph Constructors and Destructors ............................................................................11 4.2.2. Basic Query Operations................................................................................................15 4.2.3. Adding and Deleting Vertices and Edges .....................................................................24 4.2.4. Deprecated functions ....................................................................................................29 5. Error Handling ....................................................................................................................................30 5.1. Error handling basics ................................................................................................................30 5.2. Error handlers............................................................................................................................30 5.2.1. igraph_error_handler_t — Type of error handler functions...............................30 5.2.2. igraph_error_handler_abort — Abort program in case of error. ......................31 5.2.3. igraph_error_handler_ignore — Ignore errors. ................................................31 5.2.4. igraph_error_handler_printignore — Print and ignore errors.......................32 5.3. Error codes ................................................................................................................................32 5.3.1. igraph_error_type_t — Error code type. .............................................................32 5.3.2. igraph_strerror — Textual description of an error. ..............................................37 5.4. Warning messages.....................................................................................................................37 5.4.1. igraph_warning_handler_t — Type of igraph warning handler functions..........38 5.4.2. igraph_set_warning_handler — Install a warning handler ................................38 5.4.3. IGRAPH_WARNING — Trigger a warning. ....................................................................39 5.4.4. igraph_warning — Trigger a warning .....................................................................39 5.4.5. igraph_warningf — Trigger a warning, more flexible printf-like syntax ...............40 5.4.6. igraph_warning_handler_ignore — Ignore all warnings ..................................41 5.4.7. igraph_warning_handler_print — Print all warning to the standard error .......41 5.5. Advanced topics ........................................................................................................................42 5.5.1. Writing error handlers ..................................................................................................42 5.5.2. Error handling internals................................................................................................43 5.5.3. Deallocating memory ...................................................................................................46 5.5.4. Writing igraph functions with proper error handling ..................................................47 5.5.5. Error handling and threads ...........................................................................................47 6. Memory (de)allocation ........................................................................................................................48 6.1. igraph_free — Deallocate memory that was allocated by igraph functions........................48 iii
7. Data structure library: vector, matrix, other data types..................................................................50 7.1. About template types ................................................................................................................50 7.2. Vectors.......................................................................................................................................51 7.2.1. About igraph_vector_t objects......................................................................................51 7.2.2. Constructors and Destructors .......................................................................................52 7.2.3. Initializing elements .....................................................................................................55 7.2.4. Accessing elements ......................................................................................................56 7.2.5. Vector views .................................................................................................................60 7.2.6. Copying vectors............................................................................................................61 7.2.7. Exchanging elements....................................................................................................63 7.2.8. Vector operations ..........................................................................................................65 7.2.9. Vector comparisons ......................................................................................................69 7.2.10. Finding minimum and maximum ...............................................................................72 7.2.11. Vector properties.........................................................................................................76 7.2.12. Searching for elements ...............................................................................................80 7.2.13. Resizing operations ....................................................................................................83 7.2.14. Sorting ........................................................................................................................88 7.2.15. Set operations on sorted vectors .................................................................................89 7.2.16. Pointer vectors (igraph_vector_ptr_t).........................................................................90 7.3. Matrices.....................................................................................................................................98 7.3.1. About igraph_matrix_t objects .....................................................................................99 7.3.2. Matrix constructors and destructors .............................................................................99 7.3.3. Initializing elements ...................................................................................................101 7.3.4. Copying matrices........................................................................................................101 7.3.5. Accessing elements of a matrix..................................................................................103 7.3.6. Operations on rows and columns................................................................................106 7.3.7. Matrix operations........................................................................................................112 7.3.8. Matrix comparisons ....................................................................................................119 7.3.9. Combining matrices....................................................................................................122 7.3.10. Finding minimum and maximum .............................................................................123 7.3.11. Matrix properties ......................................................................................................127 7.3.12. Searching for elements .............................................................................................131 7.3.13. Resizing operations ..................................................................................................133 7.4. Sparse matrices .......................................................................................................................137 7.4.1. About igraph_spmatrix_t objects ...............................................................................137 7.4.2. Sparse matrix constructors and destructors. ...............................................................137 7.4.3. Accessing elements of a sparse matrix.......................................................................139 7.4.4. Iterating over the non-zero elements of a sparse matrix.............................................141 7.4.5. Matrix query operations .............................................................................................144 7.4.6. Matrix operations........................................................................................................148 7.4.7. Printing sparse matrices..............................................................................................150 7.5. Sparse matrices, another kind .................................................................................................151 7.5.1. About sparse matrices.................................................................................................151 7.5.2. Creating sparse matrix objects....................................................................................152 7.5.3. Query properties of a sparse matrix............................................................................157 7.5.4. Operations on sprase matrices ....................................................................................161 7.5.5. Operations that change the internal representation ....................................................169 7.5.6. Decompositions and solving linear systems...............................................................171 iv
7.5.7. Eigenvalues and eigenvectors .....................................................................................181 7.5.8. Conversion to other data types ...................................................................................183 7.5.9. Writing to a file, or to the screen ................................................................................186 7.6. Stacks ......................................................................................................................................187 7.6.1. igraph_stack_init — Initializes a stack..............................................................187 7.6.2. igraph_stack_destroy — Destroys a stack object..............................................187 7.6.3. igraph_stack_reserve — Reserve memory. .......................................................188 7.6.4. igraph_stack_empty — Decides whether a stack object is empty. ......................188 7.6.5. igraph_stack_size — Returns the number of elements in a stack. .....................189 7.6.6. igraph_stack_clear — Removes all elements from a stack. ..............................189 7.6.7. igraph_stack_push — Places an element on the top of a stack. ..........................190 7.6.8. igraph_stack_pop — Removes and returns an element from the top of a stack. .190 7.6.9. igraph_stack_top — Query top element..............................................................191 7.7. Double-ended queues..............................................................................................................191 7.7.1. igraph_dqueue_init — Initialize a double ended queue (deque). .......................192 7.7.2. igraph_dqueue_destroy — Destroy a double ended queue. ...............................192 7.7.3. igraph_dqueue_empty — Decide whether the queue is empty. ............................193 7.7.4. igraph_dqueue_full — Check whether the queue is full. ...................................193 7.7.5. igraph_dqueue_clear — Remove all elements from the queue. .........................194 7.7.6. igraph_dqueue_size — Number of elements in the queue. .................................194 7.7.7. igraph_dqueue_head — Head of the queue. .........................................................195 7.7.8. igraph_dqueue_back — Tail of the queue. ...........................................................195 7.7.9. igraph_dqueue_pop — Remove the head..............................................................196 7.7.10. igraph_dqueue_pop_back — Remove the tail ...................................................196 7.7.11. igraph_dqueue_push — Appends an element.....................................................197 7.8. Maximum and minimum heaps...............................................................................................197 7.8.1. igraph_heap_init — Initializes an empty heap object.........................................197 7.8.2. igraph_heap_init_array — Build a heap from an array....................................198 7.8.3. igraph_heap_destroy — Destroys an initialized heap object..............................199 7.8.4. igraph_heap_empty — Decides whether a heap object is empty. .........................199 7.8.5. igraph_heap_push — Add an element. .................................................................199 7.8.6. igraph_heap_top — Top element..........................................................................200 7.8.7. igraph_heap_delete_top — Return and removes the top element.....................201 7.8.8. igraph_heap_size — Number of elements...........................................................201 7.8.9. igraph_heap_reserve — Allocate more memory................................................202 7.9. String vectors ..........................................................................................................................202 7.9.1. igraph_strvector_init — Initialize...................................................................203 7.9.2. igraph_strvector_copy — Initialization by copying. ........................................203 7.9.3. igraph_strvector_destroy — Free allocated memory .....................................204 7.9.4. STR — Indexing string vectors...................................................................................204 7.9.5. igraph_strvector_get — Indexing.....................................................................205 7.9.6. igraph_strvector_set — Set an element ...........................................................205 7.9.7. igraph_strvector_set2 — Sets an element........................................................206 7.9.8. igraph_strvector_remove — Removes a single element from a string vector. .207 7.9.9. igraph_strvector_append — Concatenate two string vectors. ..........................207 7.9.10. igraph_strvector_clear — Remove all elements ...........................................208 7.9.11. igraph_strvector_resize — Resize................................................................208 7.9.12. igraph_strvector_size — Gives the size of a string vector.............................209 v
7.9.13. igraph_strvector_add — Adds an element to the back of a string vector........209 7.10. Adjacency lists ......................................................................................................................210 7.10.1. Adjacent vertices ......................................................................................................211 7.10.2. Incident edges...........................................................................................................215 7.10.3. Lazy adjacency list for vertices ................................................................................217 7.10.4. Lazy incidence list for edges ....................................................................................219 7.10.5. Deprecated functions ................................................................................................221 8. Random numbers...............................................................................................................................224 8.1. About random numbers in igraph, use cases...........................................................................224 8.2. The default random number generator....................................................................................224 8.2.1. igraph_rng_default — Query the default random number generator.................224 8.2.2. igraph_rng_set_default — Set the default igraph random number generator..224 8.3. Creating random number generators.......................................................................................225 8.3.1. igraph_rng_init — Initialize a random number generator ..................................225 8.3.2. igraph_rng_destroy — Deallocate memory associated with a random number generator .....................................................................................................................225 8.3.3. igraph_rng_seed — Set the seed of a random number generator.........................226 8.3.4. igraph_rng_min — Query the minimum possible integer for a random number generator .....................................................................................................................226 8.3.5. igraph_rng_max — Query the maximum possible integer for a random number generator .....................................................................................................................227 8.3.6. igraph_rng_name — Query the type of a random number generator ....................228 8.4. Generating random numbers...................................................................................................228 8.4.1. igraph_rng_get_integer — Generate an integer random number from an interval 228 8.4.2. igraph_rng_get_unif — Generate real, uniform random numbers from an interval 229 8.4.3. igraph_rng_get_unif01 — Generate real, uniform random number from the unit interval ........................................................................................................................230 8.4.4. igraph_rng_get_normal — Normally distributed random numbers ...................230 8.4.5. igraph_rng_get_geom — Generate geometrically distributed random numbers..231 8.4.6. igraph_rng_get_binom — Generate binomially distributed random numbers ....231 8.5. Supported random number generators ....................................................................................232 8.5.1. igraph_rngtype_mt19937 — The MT19937 random number generator.............232 8.5.2. igraph_rngtype_glibc2 — The random number generator type introduced in GNU libc 2..................................................................................................................233 8.5.3. igraph_rngtype_rand — The old BSD rand/stand random number generator....234 8.6. Use cases .................................................................................................................................234 8.6.1. Normal (default) use...................................................................................................234 8.6.2. Reproducible simulations ...........................................................................................234 8.6.3. Changing the default generator ..................................................................................235 8.6.4. Using multiple generators...........................................................................................235 8.6.5. Example......................................................................................................................235 vi
9. Graph Generators..............................................................................................................................236 9.1. Deterministic Graph Generators .............................................................................................236 9.1.1. igraph_create — Creates a graph with the specified edges..................................236 9.1.2. igraph_small — Shorthand to create a short graph, giving the edges as arguments. 237 9.1.3. igraph_adjacency — Creates a graph object from an adjacency matrix..............238 9.1.4. igraph_weighted_adjacency — Creates a graph object from a weighted adjacency matrix. ........................................................................................................239 9.1.5. igraph_adjlist — Create a graph from an adjacency list ....................................241 9.1.6. igraph_star — Creates a star graph, every vertex connects only to the center.....242 9.1.7. igraph_lattice — Creates most kinds of lattices.................................................244 9.1.8. igraph_ring — Creates a ring graph, a one dimensional lattice............................245 9.1.9. igraph_tree — Creates a tree in which almost all vertices have the same number of children. ......................................................................................................................246 9.1.10. igraph_full — Creates a full graph (directed or undirected, with or without loops). 247 9.1.11. igraph_full_citation — Creates a full citation graph ....................................248 9.1.12. igraph_famous — Create a famous graph by simply providing its name ............249 9.1.13. igraph_lcf — Create a graph from LCF notation................................................252 9.1.14. igraph_lcf_vector — Create a graph from LCF notation.................................253 9.1.15. igraph_atlas — Create a small graph from the “Graph Atlas”...........................254 9.1.16. igraph_de_bruijn — Generate a de Bruijn graph. .............................................255 9.1.17. igraph_kautz — Generate a Kautz graph. ...........................................................256 9.1.18. igraph_extended_chordal_ring — Create an extended chordal ring.............257 9.1.19. igraph_connect_neighborhood — Connects every vertex to its neighborhood 258 9.2. Games: Randomized Graph Generators..................................................................................260 9.2.1. igraph_grg_game — Generating geometric random graphs. .................................260 9.2.2. igraph_barabasi_game — Generates a graph based on the Barabási-Albert model. 261 9.2.3. igraph_erdos_renyi_game — Generates a random (Erdos-Renyi) graph...........263 9.2.4. igraph_watts_strogatz_game — The Watts-Strogatz small-world model........264 9.2.5. igraph_rewire_edges — Rewire the edges of a graph with constant probability266 9.2.6. igraph_degree_sequence_game — Generates a random graph with a given degree sequence......................................................................................................................266 9.2.7. igraph_static_fitness_game — Generates a non-growing random graph with edge probabilities........................................................................................................268 9.2.8. igraph_static_power_law_game — Generates a non-growing random graph with expected power-law degree distributions....................................................................269 9.2.9. igraph_forest_fire_game — Generates a network according to the “forest fire game” ..........................................................................................................................271 9.2.10. igraph_rewire — Randomly rewires a graph while preserving the degree distribution. .................................................................................................................273 9.2.11. igraph_growing_random_game — Generates a growing random graph............274 9.2.12. igraph_callaway_traits_game — Simulate a growing network with vertex types. ...........................................................................................................................275 9.2.13. igraph_establishment_game — Generates a graph with a simple growing model with vertex types. ........................................................................................................276 vii
9.2.14. igraph_preference_game — Generates a graph with vertex types and connection preferences ..................................................................................................................277 9.2.15. igraph_asymmetric_preference_game — Generates a graph with asymmetric vertex types and connection preferences ....................................................................279 9.2.16. igraph_recent_degree_game — Stochastic graph generator based on the number of incident edges a node has gained recently..............................................................281 9.2.17. igraph_barabasi_aging_game — Preferential attachment with aging of vertices 282 9.2.18. igraph_recent_degree_aging_game — Preferential attachment based on the number of edges gained recently, with aging of vertices............................................284 9.2.19. igraph_cited_type_game — Simulate a citation based on vertex types. ..........285 9.2.20. igraph_citing_cited_type_game — Simulate a citation network based on vertex types. ................................................................................................................287 10. Games on Graphs ............................................................................................................................289 10.1. Microscopic Update Rules ....................................................................................................289 10.1.1. igraph_deterministic_optimal_imitation — Adopt a strategy via deterministic optimal imitation...................................................................................289 10.1.2. igraph_moran_process — The Moran process in a network setting. ................291 10.1.3. igraph_roulette_wheel_imitation — Adopt a strategy via roulette wheel selection. .....................................................................................................................293 10.1.4. igraph_stochastic_imitation — Adopt a strategy via stochastic imitation with uniform selection. .......................................................................................................295 11. Vertex and Edge Selectors and Sequences, Iterators....................................................................298 11.1. About selectors, iterators.......................................................................................................298 11.2. Vertex selector constructors ..................................................................................................298 11.2.1. igraph_vs_all — Vertex set, all vertices of a graph............................................298 11.2.2. igraph_vs_adj — Adjacent vertices of a vertex. .................................................299 11.2.3. igraph_vs_nonadj — Non-adjacent vertices of a vertex.....................................300 11.2.4. igraph_vs_none — Empty vertex set...................................................................302 11.2.5. igraph_vs_1 — Vertex set with a single vertex. ...................................................302 11.2.6. igraph_vs_vector — Vertex set based on a vector. ............................................303 11.2.7. igraph_vs_vector_small — Create a vertex set by giving its elements...........304 11.2.8. igraph_vs_vector_copy — Vertex set based on a vector, with copying. ..........305 11.2.9. igraph_vs_seq — Vertex set, an interval of vertices............................................305 11.3. Generic vertex selector operations ........................................................................................306 11.3.1. igraph_vs_copy — Creates a copy of a vertex selector. ......................................307 11.3.2. igraph_vs_destroy — Destroy a vertex set........................................................307 11.3.3. igraph_vs_is_all — Check whether all vertices are included. .........................307 11.3.4. igraph_vs_size — Returns the size of the vertex selector. .................................308 11.3.5. igraph_vs_type — Returns the type of the vertex selector. ................................309 11.4. Immediate vertex selectors....................................................................................................309 11.4.1. igraph_vss_all — All vertices of a graph (immediate version).........................309 11.4.2. igraph_vss_none — Empty vertex set (immediate version). ..............................309 11.4.3. igraph_vss_1 — Vertex set with a single vertex (immediate version).................310 11.4.4. igraph_vss_vector — Vertex set based on a vector (immediate version). ........311 11.4.5. igraph_vss_seq — An interval of vertices (immediate version).........................311 11.5. Vertex iterators ......................................................................................................................312 viii
分享到:
收藏