Add graph references
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 654 B |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,627 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 22. Graph coloring</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="next" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-Isomorphism.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-Flows.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Coloring"></a>Chapter 22. Graph coloring</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Coloring.html#igraph_vertex_coloring_greedy">1. <code class="function">igraph_vertex_coloring_greedy</code> — Computes a vertex coloring using a greedy algorithm.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Coloring.html#igraph_coloring_greedy_t">2. <code class="function">igraph_coloring_greedy_t</code> — Ordering heuristics for greedy graph coloring.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Coloring.html#igraph_is_vertex_coloring">3. <code class="function">igraph_is_vertex_coloring</code> — Checks whether a vertex coloring is valid.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Coloring.html#igraph_is_bipartite_coloring">4. <code class="function">igraph_is_bipartite_coloring</code> — Checks whether a bipartite vertex coloring is valid.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Coloring.html#igraph_is_edge_coloring">5. <code class="function">igraph_is_edge_coloring</code> — Checks whether an edge coloring is valid.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Coloring.html#igraph_is_perfect">6. <code class="function">igraph_is_perfect</code> — Checks if the graph is perfect.</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_vertex_coloring_greedy"></a>1. <code class="function">igraph_vertex_coloring_greedy</code> — Computes a vertex coloring using a greedy algorithm.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.23.2.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_vertex_coloring_greedy(const igraph_t *graph, igraph_vector_int_t *colors, igraph_coloring_greedy_t heuristic);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function assigns a "color"—represented as a non-negative integer—to
|
||||
each vertex of the graph in such a way that neighboring vertices never have
|
||||
the same color. The obtained coloring is not necessarily minimal.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
Vertices are colored greedily, one by one, always choosing the smallest color
|
||||
index that differs from that of already colored neighbors. Vertices are picked
|
||||
in an order determined by the speified heuristic.
|
||||
Colors are represented by non-negative integers 0, 1, 2, ...
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>colors</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to an initialized integer vector. The vertex colors will be stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>heuristic</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The vertex ordering heuristic to use during greedy coloring.
|
||||
See <a class="link" href="igraph-Coloring.html#igraph_coloring_greedy_t" title="2. igraph_coloring_greedy_t — Ordering heuristics for greedy graph coloring."><code class="function">igraph_coloring_greedy_t</code></a> for more information.</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p><b>See also: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
igraph_is_vertex_coloring() to check if a coloring is valid, i.e. if all
|
||||
edges connect vertices of different colors.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="hideshow" onClick="toggle(this, event)">
|
||||
<div class="example">
|
||||
<a name="id-1.23.2.11.1"></a><p class="title"><b>Example 22.1. File <code class="code">examples/simple/coloring.c</code></b></p>
|
||||
<div class="example-contents">
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
igraph_t graph;
|
||||
igraph_vector_int_t colors;
|
||||
igraph_bool_t valid_coloring;
|
||||
|
||||
<span class="emphasis"><em>/* Initialize the library. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
|
||||
<span class="emphasis"><em>/* Setting a seed makes the result of erdos_renyi_game_gnm deterministic. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Random.html#igraph_rng_seed" title="3.3. igraph_rng_seed — Seeds a random number generator.">igraph_rng_seed</a></strong></span>(<span class="strong"><strong><a class="link" href="igraph-Random.html#igraph_rng_default" title="2.1. igraph_rng_default — Query the default random number generator.">igraph_rng_default</a></strong></span>(), 42);
|
||||
|
||||
<span class="emphasis"><em>/* IGRAPH_UNDIRECTED and IGRAPH_NO_LOOPS are both equivalent to 0/FALSE, but</em></span>
|
||||
<span class="emphasis"><em> communicate intent better in this context. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Games.html#igraph_erdos_renyi_game_gnm" title="1.1. igraph_erdos_renyi_game_gnm — Generates a random (Erdős-Rényi) graph with a fixed number of edges.">igraph_erdos_renyi_game_gnm</a></strong></span>(&graph, 1000, 10000, IGRAPH_UNDIRECTED, IGRAPH_SIMPLE_SW, IGRAPH_EDGE_UNLABELED);
|
||||
|
||||
<span class="emphasis"><em>/* As with all igraph functions, the vector in which the result is returned must</em></span>
|
||||
<span class="emphasis"><em> be initialized in advance. */</em></span>
|
||||
<span class="strong"><strong>igraph_vector_int_init</strong></span>(&colors, 0);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Coloring.html#igraph_vertex_coloring_greedy" title="1. igraph_vertex_coloring_greedy — Computes a vertex coloring using a greedy algorithm.">igraph_vertex_coloring_greedy</a></strong></span>(&graph, &colors, IGRAPH_COLORING_GREEDY_COLORED_NEIGHBORS);
|
||||
|
||||
<span class="emphasis"><em>/* Verify that the colouring is valid, i.e. no two adjacent vertices have the same colour. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Coloring.html#igraph_is_vertex_coloring" title="3. igraph_is_vertex_coloring — Checks whether a vertex coloring is valid.">igraph_is_vertex_coloring</a></strong></span>(&graph, &colors, &valid_coloring);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Error.html#IGRAPH_ASSERT" title="5.5.6. IGRAPH_ASSERT — igraph-specific replacement for assert().">IGRAPH_ASSERT</a></strong></span>(valid_coloring);
|
||||
|
||||
<span class="emphasis"><em>/* Destroy data structure when we are done. */</em></span>
|
||||
<span class="strong"><strong>igraph_vector_int_destroy</strong></span>(&colors);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
<br class="example-break">
|
||||
</div>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_coloring_greedy_t"></a>2. <code class="function">igraph_coloring_greedy_t</code> — Ordering heuristics for greedy graph coloring.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.23.3.2"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
typedef enum {
|
||||
IGRAPH_COLORING_GREEDY_COLORED_NEIGHBORS = 0,
|
||||
IGRAPH_COLORING_GREEDY_DSATUR = 1
|
||||
} igraph_coloring_greedy_t;
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
Ordering heuristics for <a class="link" href="igraph-Coloring.html#igraph_vertex_coloring_greedy" title="1. igraph_vertex_coloring_greedy — Computes a vertex coloring using a greedy algorithm."><code class="function">igraph_vertex_coloring_greedy()</code></a>.
|
||||
|
||||
</p>
|
||||
<p><b>Values: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_COLORING_GREEDY_COLORED_NEIGHBORS</code>:</span></p></td>
|
||||
<td><p>
|
||||
Choose the vertex with largest number of already colored neighbors.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_COLORING_GREEDY_DSATUR</code>:</span></p></td>
|
||||
<td><p>
|
||||
Choose the vertex with largest number of unique colors in its neighborhood, i.e. its
|
||||
"saturation degree". When multiple vertices have the same saturation degree, choose
|
||||
the one with the most not yet colored neighbors. Added in igraph 0.10.4. This heuristic
|
||||
is known as "DSatur", and was proposed in
|
||||
Daniel Brélaz: New methods to color the vertices of a graph,
|
||||
Commun. ACM 22, 4 (1979), 251–256. <a class="ulink" href="https://doi.org/10.1145/359094.359101" target="_top">https://doi.org/10.1145/359094.359101</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_is_vertex_coloring"></a>3. <code class="function">igraph_is_vertex_coloring</code> — Checks whether a vertex coloring is valid.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.23.4.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_is_vertex_coloring(
|
||||
const igraph_t *graph,
|
||||
const igraph_vector_int_t *types,
|
||||
igraph_bool_t *res);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function checks whether the given vertex type/color assignment is a valid
|
||||
vertex coloring, i.e., no two adjacent vertices have the same color.
|
||||
Self-loops are ignored.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>types</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The vertex types/colors as an integer vector.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>res</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to a boolean, the result is stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: O(|E|), linear in the number of edges.
|
||||
|
||||
</p>
|
||||
<div class="hideshow" onClick="toggle(this, event)">
|
||||
<div class="example">
|
||||
<a name="id-1.23.4.8.1"></a><p class="title"><b>Example 22.2. File <code class="code">examples/simple/coloring.c</code></b></p>
|
||||
<div class="example-contents">
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
igraph_t graph;
|
||||
igraph_vector_int_t colors;
|
||||
igraph_bool_t valid_coloring;
|
||||
|
||||
<span class="emphasis"><em>/* Initialize the library. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
|
||||
<span class="emphasis"><em>/* Setting a seed makes the result of erdos_renyi_game_gnm deterministic. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Random.html#igraph_rng_seed" title="3.3. igraph_rng_seed — Seeds a random number generator.">igraph_rng_seed</a></strong></span>(<span class="strong"><strong><a class="link" href="igraph-Random.html#igraph_rng_default" title="2.1. igraph_rng_default — Query the default random number generator.">igraph_rng_default</a></strong></span>(), 42);
|
||||
|
||||
<span class="emphasis"><em>/* IGRAPH_UNDIRECTED and IGRAPH_NO_LOOPS are both equivalent to 0/FALSE, but</em></span>
|
||||
<span class="emphasis"><em> communicate intent better in this context. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Games.html#igraph_erdos_renyi_game_gnm" title="1.1. igraph_erdos_renyi_game_gnm — Generates a random (Erdős-Rényi) graph with a fixed number of edges.">igraph_erdos_renyi_game_gnm</a></strong></span>(&graph, 1000, 10000, IGRAPH_UNDIRECTED, IGRAPH_SIMPLE_SW, IGRAPH_EDGE_UNLABELED);
|
||||
|
||||
<span class="emphasis"><em>/* As with all igraph functions, the vector in which the result is returned must</em></span>
|
||||
<span class="emphasis"><em> be initialized in advance. */</em></span>
|
||||
<span class="strong"><strong>igraph_vector_int_init</strong></span>(&colors, 0);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Coloring.html#igraph_vertex_coloring_greedy" title="1. igraph_vertex_coloring_greedy — Computes a vertex coloring using a greedy algorithm.">igraph_vertex_coloring_greedy</a></strong></span>(&graph, &colors, IGRAPH_COLORING_GREEDY_COLORED_NEIGHBORS);
|
||||
|
||||
<span class="emphasis"><em>/* Verify that the colouring is valid, i.e. no two adjacent vertices have the same colour. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Coloring.html#igraph_is_vertex_coloring" title="3. igraph_is_vertex_coloring — Checks whether a vertex coloring is valid.">igraph_is_vertex_coloring</a></strong></span>(&graph, &colors, &valid_coloring);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Error.html#IGRAPH_ASSERT" title="5.5.6. IGRAPH_ASSERT — igraph-specific replacement for assert().">IGRAPH_ASSERT</a></strong></span>(valid_coloring);
|
||||
|
||||
<span class="emphasis"><em>/* Destroy data structure when we are done. */</em></span>
|
||||
<span class="strong"><strong>igraph_vector_int_destroy</strong></span>(&colors);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
<br class="example-break">
|
||||
</div>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_is_bipartite_coloring"></a>4. <code class="function">igraph_is_bipartite_coloring</code> — Checks whether a bipartite vertex coloring is valid.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.23.5.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_is_bipartite_coloring(
|
||||
const igraph_t *graph,
|
||||
const igraph_vector_bool_t *types,
|
||||
igraph_bool_t *res,
|
||||
igraph_neimode_t *mode);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function checks whether the given vertex type assignment is a valid
|
||||
bipartite coloring, i.e., no two adjacent vertices have the same type.
|
||||
Additionally, for directed graphs, it determines the mode of edge directions.
|
||||
Self-loops are ignored.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>types</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The vertex types as a boolean vector.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>res</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to a boolean, the result is stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>mode</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to store the edge direction mode. Can be <code class="constant">NULL</code> if not needed.
|
||||
If all edges go from false to true vertices, <code class="constant">IGRAPH_OUT</code> is returned.
|
||||
If all edges go from true to false vertices, <code class="constant">IGRAPH_IN</code> is returned.
|
||||
If edges go in both directions or graph is undirected, <code class="constant">IGRAPH_ALL</code> is returned.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: O(|E|), linear in the number of edges.
|
||||
|
||||
</p>
|
||||
<p><b>See also: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
igraph_is_bipartite() to determine whether a graph is bipartite,
|
||||
i.e. 2-colorable, and find such a coloring.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_is_edge_coloring"></a>5. <code class="function">igraph_is_edge_coloring</code> — Checks whether an edge coloring is valid.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.23.6.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_is_edge_coloring(
|
||||
const igraph_t *graph,
|
||||
const igraph_vector_int_t *types,
|
||||
igraph_bool_t *res);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function checks whether the given edge color assignment is a valid
|
||||
edge coloring, i.e., no two adjacent edges have the same color.
|
||||
|
||||
Note that this function does not consider self-edges (loops) as being
|
||||
adjacent to themselves, so graphs with self-loops may still be considered
|
||||
to have a valid edge coloring.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>types</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The edge colors as an integer vector.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>res</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to a boolean, the result is stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: O(|V|*d*log(d)), where d is the maximum degree.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_is_perfect"></a>6. <code class="function">igraph_is_perfect</code> — Checks if the graph is perfect.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.23.7.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_is_perfect(const igraph_t *graph, igraph_bool_t *perfect);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
A perfect graph is an undirected graph in which the chromatic number of every induced
|
||||
subgraph equals the order of the largest clique of that subgraph.
|
||||
The chromatic number of a graph G is the smallest number of colors needed to
|
||||
color the vertices of G so that no two adjacent vertices share the same color.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
Warning: This function may create the complement of the graph internally,
|
||||
which consumes a lot of memory. For moderately sized graphs, consider
|
||||
decomposing them into biconnected components and running the check separately
|
||||
on each component.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
This implementation is based on the strong perfect graph theorem which was
|
||||
conjectured by Claude Berge and proved by Maria Chudnovsky, Neil Robertson,
|
||||
Paul Seymour, and Robin Thomas.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph. It is expected to be undirected and simple.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>perfect</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to an integer, the result will be stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: worst case exponenital, often faster in practice.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-Isomorphism.html"><b>← Chapter 21. Graph isomorphism</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Flows.html"><b>Chapter 23. Maximum flows, minimum cuts and related measures →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,596 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 28. Embedding of graphs</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="next" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-HRG.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-Layout.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Embedding"></a>Chapter 28. Embedding of graphs</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc"><dt><span class="section"><a href="igraph-Embedding.html#spectral-embedding">1. Spectral embedding</a></span></dt></dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="spectral-embedding"></a>1. Spectral embedding</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Embedding.html#igraph_adjacency_spectral_embedding">1.1. <code class="function">igraph_adjacency_spectral_embedding</code> — Adjacency spectral embedding</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Embedding.html#igraph_laplacian_spectral_embedding">1.2. <code class="function">igraph_laplacian_spectral_embedding</code> — Spectral embedding of the Laplacian of a graph</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Embedding.html#igraph_dim_select">1.3. <code class="function">igraph_dim_select</code> — Dimensionality selection.</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_adjacency_spectral_embedding"></a>1.1. <code class="function">igraph_adjacency_spectral_embedding</code> — Adjacency spectral embedding</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.29.2.2.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_adjacency_spectral_embedding(const igraph_t *graph,
|
||||
igraph_int_t n,
|
||||
const igraph_vector_t *weights,
|
||||
igraph_eigen_which_position_t which,
|
||||
igraph_bool_t scaled,
|
||||
igraph_matrix_t *X,
|
||||
igraph_matrix_t *Y,
|
||||
igraph_vector_t *D,
|
||||
const igraph_vector_t *cvec,
|
||||
igraph_arpack_options_t *options);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
Spectral decomposition of the adjacency matrices of graphs.
|
||||
This function computes an <code class="literal">n</code>-dimensional Euclidean
|
||||
representation of the graph based on its adjacency
|
||||
matrix, A. This representation is computed via the singular value
|
||||
decomposition of the adjacency matrix, A=U D V^T. In the case,
|
||||
where the graph is a random dot product graph generated using latent
|
||||
position vectors in R^n for each vertex, the embedding will
|
||||
provide an estimate of these latent vectors.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
For undirected graphs, the latent positions are calculated as
|
||||
X = U^n D^(1/2) where U^n equals to the first no columns of U, and
|
||||
D^(1/2) is a diagonal matrix containing the square root of the selected
|
||||
singular values on the diagonal.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
For directed graphs, the embedding is defined as the pair
|
||||
X = U^n D^(1/2), Y = V^n D^(1/2).
|
||||
(For undirected graphs U=V, so it is sufficient to keep one of them.)
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph, can be directed or undirected.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>n</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
An integer scalar. This value is the embedding dimension of
|
||||
the spectral embedding. Should be smaller than the number of
|
||||
vertices. The largest n-dimensional non-zero
|
||||
singular values are used for the spectral embedding.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>weights</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Optional edge weights. Supply a null pointer for
|
||||
unweighted graphs.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>which</code></em>:</span></p></td>
|
||||
<td>
|
||||
<p>
|
||||
Which eigenvalues (or singular values, for directed
|
||||
graphs) to use, possible values:
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_EIGEN_LM</code></span></p></td>
|
||||
<td><p>
|
||||
|
||||
the ones with the largest magnitude
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_EIGEN_LA</code></span></p></td>
|
||||
<td><p>
|
||||
|
||||
the (algebraic) largest ones
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_EIGEN_SA</code></span></p></td>
|
||||
<td><p>
|
||||
|
||||
the (algebraic) smallest ones.
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
For directed graphs, <code class="literal">IGRAPH_EIGEN_LM</code> and
|
||||
<code class="literal">IGRAPH_EIGEN_LA</code> are the same because singular
|
||||
values are used for the ordering instead of eigenvalues.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>scaled</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Whether to return X and Y (if <code class="constant">scaled</code> is true), or
|
||||
U and V.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>X</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Initialized matrix, the estimated latent positions are
|
||||
stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>Y</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Initialized matrix or a null pointer. If not a null
|
||||
pointer, then the second half of the latent positions are
|
||||
stored here. (For undirected graphs, this always equals X.)
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>D</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Initialized vector or a null pointer. If not a null
|
||||
pointer, then the eigenvalues (for undirected graphs) or the
|
||||
singular values (for directed graphs) are stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>cvec</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
A numeric vector, its length is the number vertices in the
|
||||
graph. This vector is added to the diagonal of the adjacency
|
||||
matrix, before performing the SVD.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>options</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Options to ARPACK. See <a class="link" href="igraph-Linalg.html#igraph_arpack_options_t" title="3.1.1. igraph_arpack_options_t — Options for ARPACK."><code class="function">igraph_arpack_options_t</code></a>
|
||||
for details. Supply <code class="constant">NULL</code> to use the defaults. Note that the
|
||||
function overwrites the <code class="literal">n</code> (number of vertices),
|
||||
<code class="literal">nev</code> and <code class="literal">which</code> parameters and it always
|
||||
starts the calculation from a random start vector.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_laplacian_spectral_embedding"></a>1.2. <code class="function">igraph_laplacian_spectral_embedding</code> — Spectral embedding of the Laplacian of a graph</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.29.2.3.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_laplacian_spectral_embedding(const igraph_t *graph,
|
||||
igraph_int_t n,
|
||||
const igraph_vector_t *weights,
|
||||
igraph_eigen_which_position_t which,
|
||||
igraph_laplacian_spectral_embedding_type_t type,
|
||||
igraph_bool_t scaled,
|
||||
igraph_matrix_t *X,
|
||||
igraph_matrix_t *Y,
|
||||
igraph_vector_t *D,
|
||||
igraph_arpack_options_t *options);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function essentially does the same as
|
||||
<a class="link" href="igraph-Embedding.html#igraph_adjacency_spectral_embedding" title="1.1. igraph_adjacency_spectral_embedding — Adjacency spectral embedding"><code class="function">igraph_adjacency_spectral_embedding</code></a>, but works on the Laplacian
|
||||
of the graph, instead of the adjacency matrix.
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>n</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The number of eigenvectors (or singular vectors if the graph
|
||||
is directed) to use for the embedding.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>weights</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Optional edge weights. Supply a null pointer for
|
||||
unweighted graphs.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>which</code></em>:</span></p></td>
|
||||
<td>
|
||||
<p>
|
||||
Which eigenvalues (or singular values, for directed
|
||||
graphs) to use, possible values:
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_EIGEN_LM</code></span></p></td>
|
||||
<td><p>
|
||||
|
||||
the ones with the largest magnitude
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_EIGEN_LA</code></span></p></td>
|
||||
<td><p>
|
||||
|
||||
the (algebraic) largest ones
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_EIGEN_SA</code></span></p></td>
|
||||
<td><p>
|
||||
|
||||
the (algebraic) smallest ones.
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
For directed graphs, <code class="literal">IGRAPH_EIGEN_LM</code> and
|
||||
<code class="literal">IGRAPH_EIGEN_LA</code> are the same because singular
|
||||
values are used for the ordering instead of eigenvalues.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>type</code></em>:</span></p></td>
|
||||
<td>
|
||||
<p>
|
||||
The type of the Laplacian to use. Various definitions
|
||||
exist for the Laplacian of a graph, and one can choose
|
||||
between them with this argument. Possible values:
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_EMBEDDING_D_A</code></span></p></td>
|
||||
<td><p>
|
||||
|
||||
means D - A where D is the
|
||||
degree matrix and A is the adjacency matrix
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_EMBEDDING_DAD</code></span></p></td>
|
||||
<td><p>
|
||||
|
||||
means Di times A times Di,
|
||||
where Di is the inverse of the square root of the degree matrix;
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">IGRAPH_EMBEDDING_I_DAD</code></span></p></td>
|
||||
<td><p>
|
||||
|
||||
means I - Di A Di, where I
|
||||
is the identity matrix.
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>scaled</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Whether to return X and Y (if <code class="constant">scaled</code> is true), or
|
||||
U and V.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>X</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Initialized matrix, the estimated latent positions are
|
||||
stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>Y</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Initialized matrix or a null pointer. If not a null
|
||||
pointer, then the second half of the latent positions are
|
||||
stored here. (For undirected graphs, this always equals X.)
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>D</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Initialized vector or a null pointer. If not a null
|
||||
pointer, then the eigenvalues (for undirected graphs) or the
|
||||
singular values (for directed graphs) are stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>options</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Options to ARPACK. See <a class="link" href="igraph-Linalg.html#igraph_arpack_options_t" title="3.1.1. igraph_arpack_options_t — Options for ARPACK."><code class="function">igraph_arpack_options_t</code></a>
|
||||
for details. Supply <code class="constant">NULL</code> to use the defaults. Note that the
|
||||
function overwrites the <code class="literal">n</code> (number of vertices),
|
||||
<code class="literal">nev</code> and <code class="literal">which</code> parameters and it always
|
||||
starts the calculation from a random start vector.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p><b>See also: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
<a class="link" href="igraph-Embedding.html#igraph_adjacency_spectral_embedding" title="1.1. igraph_adjacency_spectral_embedding — Adjacency spectral embedding"><code class="function">igraph_adjacency_spectral_embedding</code></a> to embed the adjacency
|
||||
matrix.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_dim_select"></a>1.3. <code class="function">igraph_dim_select</code> — Dimensionality selection.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.29.2.4.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_dim_select(const igraph_vector_t *sv, igraph_int_t *dim);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
Dimensionality selection for singular values using
|
||||
profile likelihood.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
The input of the function is a numeric vector which contains
|
||||
the measure of "importance" for each dimension.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
For spectral embedding, these are the singular values of the adjacency
|
||||
matrix. The singular values are assumed to be generated from a
|
||||
Gaussian mixture distribution with two components that have different
|
||||
means and same variance. The dimensionality d is chosen to
|
||||
maximize the likelihood when the d largest singular values are
|
||||
assigned to one component of the mixture and the rest of the singular
|
||||
values assigned to the other component.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
This function can also be used for the general separation problem,
|
||||
where we assume that the left and the right of the vector are coming
|
||||
from two normal distributions, with different means, and we want
|
||||
to know their border.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>sv</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
A numeric vector, the ordered singular values.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>dim</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The result is stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: O(n), n is the number of values in sv.
|
||||
|
||||
</p>
|
||||
<p><b>See also: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
<a class="link" href="igraph-Embedding.html#igraph_adjacency_spectral_embedding" title="1.1. igraph_adjacency_spectral_embedding — Adjacency spectral embedding"><code class="function">igraph_adjacency_spectral_embedding()</code></a>.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-HRG.html"><b>← Chapter 27. Hierarchical random graphs</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Layout.html"><b>Chapter 29. Generating layouts for graph drawing →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,212 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 35. Glossary</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="next" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-Advanced.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-Licenses.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Glossary"></a>Chapter 35. Glossary</h1></div></div></div>
|
||||
<p>
|
||||
This glossary defines common terms used throughout the igraph
|
||||
documentation.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>attribute</strong></span>: A piece of data
|
||||
associated with a vertex, an edge, or the graph itself. The
|
||||
igraph C library currently supports numeric, string and Boolean
|
||||
attribute values, and provides a means for implementing
|
||||
attribute handlers that support custom types.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>adjacent</strong></span>: Two vertices are
|
||||
called <span class="strong"><strong>adjacent</strong></span> if there is
|
||||
an edge connecting them. This term describes a vertex-to-vertex
|
||||
relation.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>adjacency list</strong></span>: A data
|
||||
structure that associates a list of neighbours (i.e. adjacent
|
||||
vertices) to each vertex.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>adjacency matrix</strong></span>: A
|
||||
representation of a graph as a square matrix.
|
||||
<code class="literal">A_ij</code> gives the number of edge endpoints
|
||||
connecting from the <code class="literal">i</code>th vertex to the
|
||||
<code class="literal">j</code>th vertex. Conventionally, the diagonal of
|
||||
the adjacency matrix of an undirected graph contains
|
||||
<span class="emphasis"><em>twice</em></span> the number of self-loops. All igraph
|
||||
functions follow this convention unless noted otherwise.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>biadjacency matrix</strong></span>: Analogous
|
||||
to the adjacency matrix, but used for bipartite graphs. Element
|
||||
<code class="literal">B_ij</code> gives the number of edges from the
|
||||
<code class="literal">i</code>th vertex of the first group to the
|
||||
<code class="literal">j</code>th vertex of the second group.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>bipartite graph</strong></span>: A graph
|
||||
whose vertices can be partitioned into two groups in such a way
|
||||
that connections are present only between members of different
|
||||
groups.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>complete graph</strong></span>: Also called
|
||||
<span class="strong"><strong>full graph</strong></span> within the context
|
||||
of igraph, a graph in which all pairs of vertices are connected
|
||||
to each other.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>connected graph</strong></span>: A connected
|
||||
graph consists of a single component, in which any vertex is
|
||||
reachable from any other. In igraph, the null graph is not
|
||||
considered connected, as it has not one, but zero components.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>edge</strong></span>: A
|
||||
<span class="strong"><strong>connection</strong></span> between two
|
||||
vertices, also called a <span class="strong"><strong>link</strong></span>.
|
||||
In igraph, edges are referred to by integer indices called
|
||||
<span class="strong"><strong>edge IDs</strong></span>.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>finalizer stack</strong></span>: A global
|
||||
stack used internally by igraph to keep track of currently
|
||||
allocated objects and their destructors, so that they can be
|
||||
automatically destroyed in case of an error.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>game</strong></span>: Within igraph, this
|
||||
term is used for stochastic graph generators, i.e. functions
|
||||
that sample from random graph models.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>graph</strong></span> or
|
||||
<span class="strong"><strong>network</strong></span>: A set of vertices
|
||||
with connections between them. In igraph, graphs may carry
|
||||
associated data in the form of vertex, edge or graph attributes.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>incident</strong></span>: An edge is called
|
||||
<span class="strong"><strong>incident</strong></span> to the vertices that
|
||||
are its endpoints. This term describes a vertex-to-edge
|
||||
relation.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>incidence list</strong></span>: A data
|
||||
structure that associates a list of incident edges to each
|
||||
vertex.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>incidence matrix</strong></span>: A matrix
|
||||
describing the incidence relation between vertices (rows) and
|
||||
edges (columns).
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>membership vector</strong></span>: Membership
|
||||
vectors are a means of encoding a partitioning of items, usually
|
||||
vertices, into several groups. The <code class="literal">i</code>th
|
||||
element of the vector gives an integer identifier of the group
|
||||
the <code class="literal">i</code>th vertex belongs to. Membership vectors
|
||||
are typically used to describe a vertex clustering obtained
|
||||
through community detection, or by identifying the connected
|
||||
components of a graph.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>multi-edges</strong></span> or
|
||||
<span class="strong"><strong>parallel edges</strong></span>: More than one
|
||||
edge connecting the same two vertices. In a directed graph,
|
||||
<code class="literal">a -> b, a -> b</code> are considered parallel
|
||||
edges, but <code class="literal">a -> b, a <- b</code> are not.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>null graph</strong></span>: A graph with no
|
||||
vertices (and no edges).
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>self-loop</strong></span>,
|
||||
<span class="strong"><strong>self-edge</strong></span>, or simply
|
||||
<span class="strong"><strong>loop</strong></span>: An edge that connects a
|
||||
vertex to itself.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>simple graph</strong></span>: A graph that
|
||||
does not have self-loops or multi-edges.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>singleton graph</strong></span>: A graph
|
||||
having a single vertex. This term usually refers to a single
|
||||
vertex with no edges, but note that self-loops may in principle
|
||||
be present.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<span class="strong"><strong>vertex</strong></span>: Graphs consist of
|
||||
vertices, also called <span class="strong"><strong>nodes</strong></span>,
|
||||
that are connected to each other. In igraph, vertices are
|
||||
referred to by integer indices called
|
||||
<span class="strong"><strong>vertex IDs</strong></span>.
|
||||
</p></li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-Advanced.html"><b>← Chapter 34. Advanced igraph programming</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Licenses.html"><b>Chapter 36. Licenses for igraph and this manual →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,383 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 26. Graphlets</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="next" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-Community.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-HRG.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Graphlets"></a>Chapter 26. Graphlets</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Graphlets.html#about-graphlets">1. Introduction</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Graphlets.html#performing-graphlet-decomposition">2. Performing graphlet decomposition</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="about-graphlets"></a>1. Introduction</h2></div></div></div>
|
||||
<p>
|
||||
Graphlet decomposition models a weighted undirected graph
|
||||
via the union of potentially overlapping dense social groups.
|
||||
This is done by a two-step algorithm. In the first step, a candidate
|
||||
set of groups (a candidate basis) is created by finding cliques
|
||||
in the thresholded input graph. In the second step,
|
||||
the graph is projected onto the candidate basis, resulting in a
|
||||
weight coefficient for each clique in the candidate basis.
|
||||
</p>
|
||||
<p>
|
||||
For more information on graphlet decomposition, see
|
||||
Hossein Azari Soufiani and Edoardo M Airoldi: "Graphlet decomposition of a weighted network",
|
||||
<a class="ulink" href="https://arxiv.org/abs/1203.2821" target="_top">https://arxiv.org/abs/1203.2821</a> and <a class="ulink" href="http://proceedings.mlr.press/v22/azari12/azari12.pdf" target="_top">http://proceedings.mlr.press/v22/azari12/azari12.pdf</a>
|
||||
</p>
|
||||
<p>
|
||||
igraph contains three functions for performing the graphlet
|
||||
decomponsition of a graph. The first is <a class="link" href="igraph-Graphlets.html#igraph_graphlets" title="2.1. igraph_graphlets — Calculate graphlets basis and project the graph on it."><code class="function">igraph_graphlets()</code></a>, which
|
||||
performs both steps of the method and returns a list of subgraphs
|
||||
with their corresponding weights. The other two functions
|
||||
correspond to the first and second steps of the algorithm, and they are
|
||||
useful if the user wishes to perform them individually:
|
||||
<a class="link" href="igraph-Graphlets.html#igraph_graphlets_candidate_basis" title="2.2. igraph_graphlets_candidate_basis — Calculate a candidate graphlets basis"><code class="function">igraph_graphlets_candidate_basis()</code></a> and
|
||||
<a class="link" href="igraph-Graphlets.html#igraph_graphlets_project" title="2.3. igraph_graphlets_project — Project a graph on a graphlets basis."><code class="function">igraph_graphlets_project()</code></a>.
|
||||
</p>
|
||||
<p>
|
||||
<em><span class="remark">
|
||||
Note: The term "graphlet" is used for several unrelated concepts
|
||||
in the literature. If you are looking to count induced subgraphs, see
|
||||
<a class="link" href="igraph-Motifs.html#igraph_motifs_randesu" title="4.1. igraph_motifs_randesu — Count the number of motifs in a graph."><code class="function">igraph_motifs_randesu()</code></a> and <a class="link" href="igraph-Isomorphism.html#igraph_subisomorphic_lad" title="4.1. igraph_subisomorphic_lad — Check subgraph isomorphism with the LAD algorithm"><code class="function">igraph_subisomorphic_lad()</code></a>.
|
||||
</span></em>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="performing-graphlet-decomposition"></a>2. Performing graphlet decomposition</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Graphlets.html#igraph_graphlets">2.1. <code class="function">igraph_graphlets</code> — Calculate graphlets basis and project the graph on it.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Graphlets.html#igraph_graphlets_candidate_basis">2.2. <code class="function">igraph_graphlets_candidate_basis</code> — Calculate a candidate graphlets basis</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Graphlets.html#igraph_graphlets_project">2.3. <code class="function">igraph_graphlets_project</code> — Project a graph on a graphlets basis.</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_graphlets"></a>2.1. <code class="function">igraph_graphlets</code> — Calculate graphlets basis and project the graph on it.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.27.3.2.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_graphlets(const igraph_t *graph,
|
||||
const igraph_vector_t *weights,
|
||||
igraph_vector_int_list_t *cliques,
|
||||
igraph_vector_t *Mu, igraph_int_t niter);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function simply calls <a class="link" href="igraph-Graphlets.html#igraph_graphlets_candidate_basis" title="2.2. igraph_graphlets_candidate_basis — Calculate a candidate graphlets basis"><code class="function">igraph_graphlets_candidate_basis()</code></a>
|
||||
and <a class="link" href="igraph-Graphlets.html#igraph_graphlets_project" title="2.3. igraph_graphlets_project — Project a graph on a graphlets basis."><code class="function">igraph_graphlets_project()</code></a>, and then orders the graphlets
|
||||
according to decreasing weights.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph, it must be a simple graph, edge directions are
|
||||
ignored.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>weights</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Weights of the edges, a vector.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>cliques</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
An initialized list of integer vectors. The graphlet basis is
|
||||
stored here. Each element of the list is an integer vector of
|
||||
vertex IDs, encoding a single basis subgraph.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>Mu</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
An initialized vector, the weights of the graphlets will
|
||||
be stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>niter</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The number of iterations to perform for the projection step.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
See also: <a class="link" href="igraph-Graphlets.html#igraph_graphlets_candidate_basis" title="2.2. igraph_graphlets_candidate_basis — Calculate a candidate graphlets basis"><code class="function">igraph_graphlets_candidate_basis()</code></a> and
|
||||
<a class="link" href="igraph-Graphlets.html#igraph_graphlets_project" title="2.3. igraph_graphlets_project — Project a graph on a graphlets basis."><code class="function">igraph_graphlets_project()</code></a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_graphlets_candidate_basis"></a>2.2. <code class="function">igraph_graphlets_candidate_basis</code> — Calculate a candidate graphlets basis</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.27.3.3.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_graphlets_candidate_basis(const igraph_t *graph,
|
||||
const igraph_vector_t *weights,
|
||||
igraph_vector_int_list_t *cliques,
|
||||
igraph_vector_t *thresholds);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph, it must be a simple graph, edge directions are
|
||||
ignored.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>weights</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Weights of the edges, a vector.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>cliques</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
An initialized list of integer vectors. The graphlet basis is
|
||||
stored here. Each element of the list is an integer vector of
|
||||
vertex IDs, encoding a single basis subgraph.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>thresholds</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
An initialized vector, the (highest possible)
|
||||
weight thresholds for finding the basis subgraphs are stored
|
||||
here.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
See also: <a class="link" href="igraph-Graphlets.html#igraph_graphlets" title="2.1. igraph_graphlets — Calculate graphlets basis and project the graph on it."><code class="function">igraph_graphlets()</code></a> and <a class="link" href="igraph-Graphlets.html#igraph_graphlets_project" title="2.3. igraph_graphlets_project — Project a graph on a graphlets basis."><code class="function">igraph_graphlets_project()</code></a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_graphlets_project"></a>2.3. <code class="function">igraph_graphlets_project</code> — Project a graph on a graphlets basis.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.27.3.4.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_graphlets_project(const igraph_t *graph,
|
||||
const igraph_vector_t *weights,
|
||||
const igraph_vector_int_list_t *cliques,
|
||||
igraph_vector_t *Mu, igraph_bool_t startMu,
|
||||
igraph_int_t niter);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
Note that the graph projected does not have to be the same that
|
||||
was used to calculate the graphlet basis, but it is assumed that
|
||||
it has the same number of vertices, and the vertex IDs of the two
|
||||
graphs match.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph, it must be a simple graph, edge directions are
|
||||
ignored.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>weights</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Weights of the edges in the input graph, a vector.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>cliques</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
An initialized list of integer vectors. The graphlet basis is
|
||||
stored here. Each element of the list is an integer vector of
|
||||
vertex IDs, encoding a single basis subgraph.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>Mu</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
An initialized vector, the weights of the graphlets will
|
||||
be stored here. This vector is also used to initialize the
|
||||
the weight vector for the iterative algorithm, if the
|
||||
<code class="constant">startMu</code> argument is true.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>startMu</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
If true, then the supplied Mu vector is
|
||||
used as the starting point of the iteration. Otherwise a
|
||||
constant 1 vector is used.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>niter</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The number of iterations to perform.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
See also: <a class="link" href="igraph-Graphlets.html#igraph_graphlets" title="2.1. igraph_graphlets — Calculate graphlets basis and project the graph on it."><code class="function">igraph_graphlets()</code></a> and
|
||||
<a class="link" href="igraph-Graphlets.html#igraph_graphlets_candidate_basis" title="2.2. igraph_graphlets_candidate_basis — Calculate a candidate graphlets basis"><code class="function">igraph_graphlets_candidate_basis()</code></a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-Community.html"><b>← Chapter 25. Detecting community structure</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-HRG.html"><b>Chapter 27. Hierarchical random graphs →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,661 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 2. Installation</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="next" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-Introduction.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-Tutorial.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Installation"></a>Chapter 2. Installation</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-prerequisites">1. Prerequisites</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-installation">2. Installation</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-building-the-documentation">3. Building the documentation</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-notes-for-package-maintainers">4. Notes for package maintainers</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
This chapter describes building igraph from source code and installing it.
|
||||
The source archive of the latest stable release is always available
|
||||
<a class="ulink" href="https://igraph.org/c/#downloads" target="_top">from the igraph website</a>.
|
||||
igraph is also included in many Linux distributions, as well as several package
|
||||
managers such as <a class="ulink" href="https://vcpkg.io/" target="_top">vcpkg</a> (convenient on Windows),
|
||||
<a class="ulink" href="https://www.macports.org/" target="_top">MacPorts</a> (macOS) and
|
||||
<a class="ulink" href="https://brew.sh/" target="_top">Homebrew</a> (macOS), which provide an easier
|
||||
means of installation. If you decide to use them, please consult their documentation
|
||||
on how to install packages.
|
||||
</p>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph-Installation-prerequisites"></a>1. Prerequisites</h2></div></div></div>
|
||||
<p>
|
||||
To build igraph from sources, you will need at least:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>
|
||||
<a class="ulink" href="https://cmake.org" target="_top">CMake</a> 3.18 or later
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
C and C++ compilers
|
||||
</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Visual Studio 2015 and later are supported. Earlier Visual Studio
|
||||
versions may or may not work.
|
||||
</p>
|
||||
<p>
|
||||
Certain features also require the following libraries:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
|
||||
<a class="ulink" href="http://www.xmlsoft.org/" target="_top">libxml2</a>,
|
||||
required for GraphML support
|
||||
</p></li></ul></div>
|
||||
<p>
|
||||
igraph bundles a number of libraries for convenience. However, it is
|
||||
preferable to use external versions of these libraries, which may
|
||||
improve performance. These are:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>
|
||||
<a class="ulink" href="https://gmplib.org/" target="_top">GMP</a> (the bundled
|
||||
alternative is Mini-GMP)
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<a class="ulink" href="https://www.gnu.org/software/glpk/" target="_top">GLPK</a> (version 4.57 or later)
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<a class="ulink" href="https://github.com/opencollab/arpack-ng" target="_top">ARPACK</a>
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<a class="ulink" href="https://github.com/ntamas/plfit" target="_top">plfit</a>
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
A library providing a
|
||||
<a class="ulink" href="https://www.netlib.org/blas/" target="_top">BLAS</a> API
|
||||
(available by default on macOS;
|
||||
<a class="ulink" href="http://www.openmathlib.org/OpenBLAS/" target="_top">OpenBLAS</a> is one
|
||||
option on other systems)
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
A library providing a
|
||||
<a class="ulink" href="https://www.netlib.org/lapack/" target="_top">LAPACK</a>
|
||||
API (available by default on macOS;
|
||||
<a class="ulink" href="http://www.openmathlib.org/OpenBLAS/" target="_top">OpenBLAS</a> is one
|
||||
option on other systems)
|
||||
</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
When building the development version of igraph,
|
||||
<code class="literal">bison</code>, <code class="literal">flex</code> and
|
||||
<code class="literal">git</code> are also required. Released versions do not
|
||||
require these tools.
|
||||
</p>
|
||||
<p>
|
||||
To run the tests, <code class="literal">diff</code> is also required.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph-Installation-installation"></a>2. Installation</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-general-build-instructions">2.1. General build instructions</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-specific-instructions-for-windows">2.2. Specific instructions for Windows</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-notable-configuration-options">2.3. Notable configuration options</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph-Installation-general-build-instructions"></a>2.1. General build instructions</h3></div></div></div>
|
||||
<p>
|
||||
igraph uses a
|
||||
<a class="ulink" href="https://cmake.org/cmake/help/latest/guide/user-interaction/index.html" target="_top">CMake-based
|
||||
build system</a>. To compile it,
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
<p>
|
||||
Enter the directory where the igraph sources are:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
$ cd igraph
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<p>
|
||||
Create a new directory. This is where igraph will be built:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<p>
|
||||
Run CMake, which will automatically configure igraph, and
|
||||
report the configuration:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
$ cmake ..
|
||||
</pre>
|
||||
<p>
|
||||
To set a non-default installation location, such as
|
||||
<code class="literal">/opt/local</code>, use:
|
||||
</p>
|
||||
<pre class="programlisting">cmake .. -DCMAKE_INSTALL_PREFIX=/opt/local</pre>
|
||||
<p>
|
||||
</p>
|
||||
</li>
|
||||
<li class="listitem"><p>
|
||||
Check the output carefully, and ensure that all features you
|
||||
need are enabled. If CMake could not find certain libraries,
|
||||
some features such as GraphML support may have been
|
||||
automatically disabled.
|
||||
</p></li>
|
||||
<li class="listitem">
|
||||
<p>
|
||||
There are several ways to adjust the configuration:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
|
||||
<li class="listitem"><p>
|
||||
Run <code class="literal">ccmake .</code> on Unix-like systems or
|
||||
<code class="literal">cmake-gui</code> on Windows for a convenient
|
||||
interface.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Simply edit the <code class="literal">CMakeCache.txt</code> file.
|
||||
Some of the relevant options are listed below.
|
||||
</p></li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li class="listitem"><p>
|
||||
Once the configuration has been adjusted, run
|
||||
<code class="literal">cmake ..</code> again.
|
||||
</p></li>
|
||||
<li class="listitem">
|
||||
<p>
|
||||
Once igraph has been successfully configured, it can be built,
|
||||
tested and installed using:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
$ cmake --build .
|
||||
$ cmake --build . --target check
|
||||
$ cmake --install .
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph-Installation-specific-instructions-for-windows"></a>2.2. Specific instructions for Windows</h3></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-microsoft-visual-studio">2.2.1. Microsoft Visual Studio</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-msys2">2.2.2. MSYS2</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="igraph-Installation-microsoft-visual-studio"></a>2.2.1. Microsoft Visual Studio</h4></div></div></div>
|
||||
<p>
|
||||
With Visual Studio, the steps to build igraph are generally the
|
||||
same as above. However, since the Visual Studio CMake generator is
|
||||
a multi-configuration one, we must specify the configuration
|
||||
(typically Release or Debug) with each build command using the
|
||||
<code class="literal">--config</code> option:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release
|
||||
cmake --build . --target check --config Release
|
||||
</pre>
|
||||
<p>
|
||||
When building the development version, <code class="literal">bison</code>
|
||||
and <code class="literal">flex</code> must be available on the system.
|
||||
<a class="ulink" href="https://github.com/lexxmark/winflexbison" target="_top"><code class="literal">winflexbison</code></a>
|
||||
for Bison version 3.x can be useful for this purpose—make sure
|
||||
that the executables are in the system <code class="literal">PATH</code>.
|
||||
The easiest installation option is probably by installing
|
||||
<code class="literal">winflexbison3</code> from the
|
||||
<a class="ulink" href="https://chocolatey.org/packages/winflexbison3" target="_top">Chocolatey
|
||||
package manager</a>.
|
||||
</p>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="igraph-Installation-vcpkg"></a>2.2.1.1. vcpkg</h5></div></div></div>
|
||||
<p>
|
||||
Most external dependencies can be conveniently installed using
|
||||
<a class="ulink" href="https://github.com/microsoft/vcpkg#quick-start-windows" target="_top"><code class="literal">vcpkg</code></a>.
|
||||
Note that <code class="literal">igraph</code> bundles all dependencies
|
||||
except <code class="literal">libxml2</code>, which is needed for GraphML
|
||||
support.
|
||||
</p>
|
||||
<p>
|
||||
In order to use vcpkg integrate it in the build environment by executing
|
||||
<code class="literal">vcpkg.exe integrate install</code> on the command line.
|
||||
When configuring igraph, point CMake to the correct
|
||||
<code class="literal">vcpkg.cmake</code> file using <code class="literal">-DCMAKE_TOOLCHAIN_FILE=...</code>,
|
||||
as instructed.
|
||||
</p>
|
||||
<p>
|
||||
Additionally, it might be that you need to set the appropriate
|
||||
so-called triplet using
|
||||
<code class="literal">-DVCPKG_TARGET_TRIPLET</code> when running
|
||||
<code class="literal">cmake</code>, for exampling, setting it to
|
||||
<code class="literal">x64-windows</code> when using shared builds of packages or
|
||||
<code class="literal">x64-windows-static</code> when using static builds.
|
||||
Similarly, you also need to specify this target triplet when
|
||||
installing packages. For example, to install
|
||||
<code class="literal">libxml2</code> as a shared library, use
|
||||
<code class="literal">vcpkg.exe install libxml2:x64-windows</code> and to
|
||||
install <code class="literal">libxml2</code> as a static library, use
|
||||
<code class="literal">vcpkg.exe install libxml2:x64-windows-static</code>.
|
||||
In addition, there is the possibility to use a static library
|
||||
with dynamic runtime linking using the
|
||||
<code class="literal">x64-windows-static-md</code> triplet.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="igraph-Installation-msys2"></a>2.2.2. MSYS2</h4></div></div></div>
|
||||
<p>
|
||||
MSYS2 can be installed from <a class="ulink" href="https://www.msys2.org/" target="_top">msys2.org</a>. After installing MSYS2,
|
||||
ensure that it is up to date by opening a terminal and running
|
||||
<code class="literal">pacman -Syuu</code>.
|
||||
</p>
|
||||
<p>
|
||||
The instructions below assume that you want to compile for a 64-bit
|
||||
target.
|
||||
</p>
|
||||
<p>
|
||||
Install the following packages using <code class="literal">pacman -S</code>.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>
|
||||
Minimal requirements:
|
||||
<code class="literal">mingw-w64-x86_64-toolchain</code>,
|
||||
<code class="literal">mingw-w64-x86_64-cmake</code>.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Optional dependencies that enable certain features:
|
||||
<code class="literal">mingw-w64-x86_64-gmp</code>,
|
||||
<code class="literal">mingw-w64-x86_64-libxml2</code>
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Optional external libraries for better performance:
|
||||
<code class="literal">mingw-w64-x86_64-openblas</code>,
|
||||
<code class="literal">mingw-w64-x86_64-arpack</code>,
|
||||
<code class="literal">mingw-w64-x86_64-glpk</code>
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Only needed for running the tests: <code class="literal">diffutils</code>
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Required only when building the development version:
|
||||
<code class="literal">git</code>, <code class="literal">bison</code>,
|
||||
<code class="literal">flex</code>
|
||||
</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The following command will install of these at once:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
pacman -S \
|
||||
mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake \
|
||||
mingw-w64-x86_64-gmp mingw-w64-x86_64-libxml2 \
|
||||
mingw-w64-x86_64-openblas mingw-w64-x86_64-arpack \
|
||||
mingw-w64-x86_64-glpk diffutils git bison flex
|
||||
</pre>
|
||||
<p>
|
||||
In order to build igraph, follow the <span class="strong"><strong>General
|
||||
build instructions</strong></span> above, paying attention to the
|
||||
following:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>
|
||||
When using MSYS2, start the <span class="quote">“<span class="quote">MSYS2 MinGW 64-bit</span>”</span>
|
||||
terminal, and <span class="emphasis"><em>not</em></span> the <span class="quote">“<span class="quote">MSYS2
|
||||
MSYS</span>”</span> one.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Be sure to install the <code class="literal">mingw-w64-x86_64-cmake</code>
|
||||
package and not the <code class="literal">cmake</code> one. The latter
|
||||
will not work.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
When running <code class="literal">cmake</code>, pass the option
|
||||
<code class="literal">-G"MSYS Makefiles"</code>.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Note that <code class="literal">ccmake</code> is not currently available.
|
||||
<code class="literal">cmake-gui</code> can be used only if the
|
||||
<code class="literal">mingw-w64-x86_64-qt5</code> package is installed.
|
||||
</p></li>
|
||||
</ul></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph-Installation-notable-configuration-options"></a>2.3. Notable configuration options</h3></div></div></div>
|
||||
<p>
|
||||
The following options may be set to <code class="literal">ON</code> or
|
||||
<code class="literal">OFF</code>. Some of them have an <code class="literal">AUTO</code>
|
||||
setting, which chooses a reasonable default based on what libraries
|
||||
are available on the current system.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>
|
||||
igraph bundles some of its dependencies for convenience. The
|
||||
<code class="literal">IGRAPH_USE_INTERNAL_XXX</code> flags control whether
|
||||
these should be used instead of external versions. Set them to
|
||||
<code class="literal">ON</code> to use the bundled
|
||||
(<span class="quote">“<span class="quote">vendored</span>”</span>) versions. Generally, external versions
|
||||
are preferable as they may be newer and usually provide better
|
||||
performance.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<code class="literal">IGRAPH_GLPK_SUPPORT</code>: whether to make use of
|
||||
the
|
||||
<a class="ulink" href="https://www.gnu.org/software/glpk/" target="_top">GLPK</a>
|
||||
library. Some features, such as finding a minimum feedback arc
|
||||
set or finding communities through exact modularity
|
||||
optimization, require this.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<code class="literal">IGRAPH_GRAPHML_SUPPORT</code>: whether to enable
|
||||
support for reading and writing
|
||||
<a class="ulink" href="http://graphml.graphdrawing.org/" target="_top">GraphML</a>
|
||||
files. Requires the
|
||||
<a class="ulink" href="http://xmlsoft.org/" target="_top">libxml2</a> library.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<code class="literal">IGRAPH_INFOMAP_SUPPORT</code>: whether to enable
|
||||
the Infomap community detection algorithm. The Infomap library
|
||||
is licensed under the GPLv3+. Compiling it into igraph causes
|
||||
GPLv3+ to apply to the resulting binary, instead of igraph's
|
||||
GPLv2+ license.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<code class="literal">IGRAPH_OPENMP_SUPPORT</code>: whether to use OpenMP
|
||||
parallelization to accelerate certain functions such as PageRank
|
||||
calculation. Compiler support is required.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<code class="literal">IGRAPH_ENABLE_LTO</code>: whether to build igraph
|
||||
with link-time optimization, which improves performance. Not
|
||||
supported with all compilers.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<code class="literal">IGRAPH_ENABLE_TLS</code>: whether to enable
|
||||
thread-local storage. Required when using igraph from multiple
|
||||
threads.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<code class="literal">IGRAPH_WARNINGS_AS_ERRORS</code>: whether to treat
|
||||
compiler warnings as errors. We strive to eliminate all compiler
|
||||
warnings during development so this switch is turned on by default.
|
||||
If your compiler prints warnings for some parts of the code that we
|
||||
did not anticipate, you can turn off this option to prevent the
|
||||
warnings from stopping the compilation.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<a class="ulink" href="https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html" target="_top"><code class="literal">BUILD_SHARED_LIBS</code></a>:
|
||||
whether to build a shared library instead of a static one.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<code class="literal">BLA_VENDOR</code>: controls which library to use for
|
||||
<a class="ulink" href="https://cmake.org/cmake/help/latest/module/FindBLAS.html" target="_top">BLAS</a>
|
||||
and
|
||||
<a class="ulink" href="https://cmake.org/cmake/help/latest/module/FindLAPACK.html" target="_top">LAPACK</a>
|
||||
functionality.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
<a class="ulink" href="https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html" target="_top"><code class="literal">CMAKE_INSTALL_PREFIX</code></a>:
|
||||
the location where igraph will be installed.
|
||||
</p></li>
|
||||
</ul></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph-Installation-building-the-documentation"></a>3. Building the documentation</h2></div></div></div>
|
||||
<p>
|
||||
Most users will not need to build the documentation, as the release
|
||||
tarball contains pre-built HTML documentation in the <code class="literal">doc</code>
|
||||
directory.
|
||||
</p>
|
||||
<p>
|
||||
To build the documentation for the development version, simply build the
|
||||
<code class="literal">html</code>, <code class="literal">pdf</code> or <code class="literal">info</code>
|
||||
targets for the HTML, PDF and Info versions of the documentation,
|
||||
respectively.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
$ cmake --build . --target html
|
||||
</pre>
|
||||
<p>
|
||||
Building the HTML documentation requires Python 3, <code class="literal">xmlto</code>
|
||||
and <code class="literal">source-highlight</code>. On some platforms, it is necessary
|
||||
to explicitly install the docbook-xsl package as well. Building the PDF
|
||||
documentation also requires <code class="literal">xsltproc</code>,
|
||||
<code class="literal">xmllint</code> and <code class="literal">fop</code>. Building the Texinfo
|
||||
documentation also requires the docbook2X package, <code class="literal">xmllint</code>
|
||||
and <code class="literal">makeinfo</code>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph-Installation-notes-for-package-maintainers"></a>4. Notes for package maintainers</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-auto-detection-of-dependencies">4.1. Auto-detection of dependencies</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-shared-and-static-builds">4.2. Shared and static builds</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-cross-compiling">4.3. Cross-compiling</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Installation.html#igraph-Installation-additional-notes">4.4. Additional notes</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
This section is for people who package igraph for Linux distros or
|
||||
other package managers. Please read it carefully before packaging
|
||||
igraph.
|
||||
</p>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph-Installation-auto-detection-of-dependencies"></a>4.1. Auto-detection of dependencies</h3></div></div></div>
|
||||
<p>
|
||||
igraph bundles several of its dependencies (or simplified versions
|
||||
of its dependencies). During configuration time, it checks whether
|
||||
each dependency is present on the system. If yes, it uses it.
|
||||
Otherwise, it falls back to the bundled (<span class="quote">“<span class="quote">vendored</span>”</span>)
|
||||
version. In order to make configuration as deterministic as
|
||||
possible, you may want to disable this auto-detection. To do so, set
|
||||
each of the <code class="literal">IGRAPH_USE_INTERNAL_XXX</code> options
|
||||
described above. Additionally, set <code class="literal">BLA_VENDOR</code> to
|
||||
use the BLAS and LAPACK implementations of your choice. This should
|
||||
be the same BLAS and LAPACK library that igraph's other dependencies
|
||||
(e.g., ARPACK) are linked against.
|
||||
</p>
|
||||
<p>
|
||||
For example, to force igraph to use external versions of all
|
||||
dependencies except plfit, and to use OpenBLAS for BLAS/LAPACK, use
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
$ cmake .. \
|
||||
-DIGRAPH_USE_INTERNAL_BLAS=OFF \
|
||||
-DIGRAPH_USE_INTERNAL_LAPACK=OFF \
|
||||
-DIGRAPH_USE_INTERNAL_ARPACK=OFF \
|
||||
-DIGRAPH_USE_INTERNAL_GLPK=OFF \
|
||||
-DIGRAPH_USE_INTERNAL_GMP=OFF \
|
||||
-DIGRAPH_USE_INTERNAL_PLFIT=ON \
|
||||
-DBLA_VENDOR=OpenBLAS \
|
||||
-DIGRAPH_GRAPHML_SUPPORT=ON
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph-Installation-shared-and-static-builds"></a>4.2. Shared and static builds</h3></div></div></div>
|
||||
<p>
|
||||
On Windows, shared and static builds should not be installed in the same
|
||||
location. If you decide to do so anyway, keep in mind the following:
|
||||
Both builds contain an <code class="literal">igraph.lib</code> file. The static one
|
||||
should be renamed to avoid conflict. The headers from the static build
|
||||
are incompatible with the shared library. The headers from the shared build
|
||||
may be used with the static library, but <code class="literal">IGRAPH_STATIC</code>
|
||||
must be defined when compiling programs that will link to igraph statically.
|
||||
</p>
|
||||
<p>
|
||||
These issues do not affect Unix-like systems.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph-Installation-cross-compiling"></a>4.3. Cross-compiling</h3></div></div></div>
|
||||
<p>
|
||||
When building igraph with an internal ARPACK, LAPACK or BLAS, it
|
||||
makes use of f2c, which compiles and runs the <code class="literal">arithchk</code>
|
||||
program at build time to detect the floating point characteristics of the
|
||||
current system. It writes the results into the <code class="literal">arith.h</code>
|
||||
header. However, running this program is not possible when cross-compiling
|
||||
without providing a userspace emulator that can run executables of the
|
||||
target platform on the host system. Therefore, when cross-compiling, you
|
||||
either need to provide such an emulator with the
|
||||
<code class="literal">CMAKE_CROSSCOMPILING_EMULATOR</code> option, or you need to
|
||||
specify a pre-generated version of the <code class="literal">arith.h</code> header
|
||||
file through the <code class="literal">F2C_EXTERNAL_ARITH_HEADER</code>
|
||||
CMake option. An example version of this header follows for the
|
||||
x86_64 and arm64 target architectures on macOS. Warning: Do not use this
|
||||
version of <code class="literal">arith.h</code> on other systems or architectures.
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
#define IEEE_8087
|
||||
#define Arith_Kind_ASL 1
|
||||
#define Long int
|
||||
#define Intcast (int)(long)
|
||||
#define Double_Align
|
||||
#define X64_bit_pointers
|
||||
#define NANCHECK
|
||||
#define QNaN0 0x0
|
||||
#define QNaN1 0x7ff80000
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
igraph also checks whether the endianness of <code class="literal">uint64_t</code>
|
||||
matches the endianness of <code class="literal">double</code> on the platform
|
||||
being compiled. This is needed to ensure that certain functions in igraph's
|
||||
random number generator work properly. However, it is not possible to
|
||||
execute this check when cross-compiling without an emulator, so in this
|
||||
case igraph simply assumes that the endianness matches (which is the case
|
||||
for the vast majority of platforms anyway). The only case where you might
|
||||
run into problems is when you cross-compile for Apple Silicon
|
||||
(<code class="literal">arm64</code>) from an Intel-based Mac, in which case CMake
|
||||
might not realize that you are cross-compiling and will try to execute
|
||||
the check anyway. You can work around this by setting
|
||||
<code class="literal">IEEE754_DOUBLE_ENDIANNESS_MATCHES</code> to <code class="literal">ON</code>
|
||||
explicitly before invoking CMake.
|
||||
</p>
|
||||
<p>
|
||||
Providing an emulator in <code class="literal">CMAKE_CROSSCOMPILING_EMULATOR</code>
|
||||
has the added benefit that you can run the compiled unit tests on the
|
||||
host platform. We have experimented with cross-compiling to 64-bit ARM
|
||||
CPUs (<code class="literal">aarch64</code>) on 64-bit Intel CPUs (<code class="literal">amd64</code>),
|
||||
and we can confirm that using <code class="literal">qemu-aarch64</code> works as a
|
||||
cross-compiling emulator in this setup.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph-Installation-additional-notes"></a>4.4. Additional notes</h3></div></div></div>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>
|
||||
As of igraph 0.10, there is no tangible benefit to using an
|
||||
external GMP, as igraph does not yet use GMP in any
|
||||
performance-critical way. The bundled Mini-GMP is sufficient.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Link-time optimization noticeably improves the performance of
|
||||
some igraph functions. To enable it, use
|
||||
<code class="literal">-DIGRAPH_ENABLE_LTO=ON</code>.
|
||||
The <code class="literal">AUTO</code> setting is also supported, and will
|
||||
enable link-time optimization only if the current compiler
|
||||
supports it. Note that this is detected by CMake, and the
|
||||
detection is not always accurate.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
We saw occasional hangs on Windows when igraph was built for a
|
||||
32-bit target with MinGW and linked to OpenBLAS. We believe this
|
||||
to be an issue with OpenBLAS, not igraph. On this platform, you
|
||||
may want to opt for a different BLAS/LAPACK or the bundled
|
||||
BLAS/LAPACK.
|
||||
</p></li>
|
||||
</ul></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-Introduction.html"><b>← Chapter 1. Introduction</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Tutorial.html"><b>Chapter 3. Tutorial →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,175 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 1. Introduction</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="next" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="index.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-Installation.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Introduction"></a>Chapter 1. Introduction</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Introduction.html#igraph-is-free-software">1. igraph is free software</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Introduction.html#citing-igraph">2. Citing igraph</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
igraph is a library for creating and manipulating graphs.
|
||||
You can look at it in two ways: first, igraph contains the implementation
|
||||
of quite a lot of graph algorithms. These include classic graph
|
||||
algorithms like graph isomorphism, graph girth and connectivity and
|
||||
also the new wave graph algorithms like transitivity, graph motifs and
|
||||
community structure detection. Skim through the table of contents
|
||||
or the index of this book to get an impression of what is available.</p>
|
||||
<p>
|
||||
Second, igraph provides a platform for developing and/or
|
||||
implementing graph algorithms. It has an efficient data structure
|
||||
for representing graphs, and a number of other data structures like
|
||||
flexible vectors, stacks, heaps, queues, adjacency lists that are useful for implementing graph algorithms. In fact these data structures evolved along with the
|
||||
implementation of the classic and non-classic graph algorithms which
|
||||
make up the major part of the igraph library. This way, they were fine-tuned
|
||||
and checked for correctness several times.
|
||||
</p>
|
||||
<p>
|
||||
Our main goal with developing igraph was to create a graph library
|
||||
which is efficient on large, but not extremely large graphs. More
|
||||
precisely, it is assumed that the graph(s) fit into the physical
|
||||
memory of the computer. Nowadays this means graphs with
|
||||
several million vertices and/or edges. Our definition of efficient is
|
||||
that it runs fast, both in theory and (more importantly) in practice.
|
||||
</p>
|
||||
<p>
|
||||
We believe that one of the big strengths of igraph is that it can be
|
||||
embedded into a higher-level language or environment. Three such
|
||||
embeddings (or interfaces if you look at them another way)
|
||||
are currently being developed by us: an R
|
||||
package, a Python extension module, and a Mathematica (Wolfram Language) package. Others are
|
||||
likely to come. High level languages such as R or Python make it
|
||||
possible to use graph routines with much greater comfort, without
|
||||
actually writing a single line of C code. They have some, usually very
|
||||
small, speed penalty compared to the C version, but add ease of use and much
|
||||
flexibility. This manual, however, covers only the C library. If you
|
||||
want to use Python, R or the Wolfram Language, please see the documentation written
|
||||
specifically for these interfaces and come back here only if you are
|
||||
interested in some detail which is not covered in those documents.
|
||||
</p>
|
||||
<p>
|
||||
We still consider igraph as a child project. It has much room for
|
||||
development and we are sure that it will improve a lot in the near
|
||||
future. Any feedback we can get from the users is very important for
|
||||
us, as most of the time these questions and comments guide us in what
|
||||
to add and what to improve.
|
||||
</p>
|
||||
<p>
|
||||
igraph is open source and distributed under the terms of the GNU GPL
|
||||
version 2 or (at your option) any later version.
|
||||
We strongly believe that all the algorithms used in science, let that
|
||||
be graph theory or not, should have an efficient open-source
|
||||
implementation allowing use and modification for anyone.
|
||||
</p>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph-is-free-software"></a>1. igraph is free software</h2></div></div></div>
|
||||
<p>
|
||||
igraph library
|
||||
</p>
|
||||
<p>
|
||||
Copyright (C) 2003-2004 Gábor Csárdi <csardi.gabor@gmail.com>
|
||||
</p>
|
||||
<p>
|
||||
Copyright (C) 2005-2019 Gábor Csárdi <csardi.gabor@gmail.com> and Tamás Nepusz <ntamas@gmail.com>
|
||||
</p>
|
||||
<p>
|
||||
Copyright (C) 2020-2023 The igraph development team
|
||||
</p>
|
||||
<p>
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
</p>
|
||||
<p>
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
</p>
|
||||
<p>
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="citing-igraph"></a>2. Citing igraph</h2></div></div></div>
|
||||
<p>
|
||||
To cite igraph in publications, please use the following
|
||||
reference:
|
||||
</p>
|
||||
<p>
|
||||
Gábor Csárdi, Tamás Nepusz: The igraph software package for complex network
|
||||
research. InterJournal Complex Systems, 1695, 2006.
|
||||
</p>
|
||||
<p>
|
||||
The igraph C library is assigned the DOI <a class="ulink" href="https://doi.org/10.5281/zenodo.3630268" target="_top">10.5281/zenodo.3630268</a> on Zenodo.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="index.html"><b>← igraph Reference Manual</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Installation.html"><b>Chapter 2. Installation →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,994 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 36. Licenses for igraph and this manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="next" href="ix01.html" title="Index">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-Glossary.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="ix01.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Licenses"></a>Chapter 36. Licenses for igraph and this manual</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#igraph-gpl">1. THE GNU GENERAL PUBLIC LICENSE</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#igraph-fdl">2. The GNU Free Documentation License</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div>
|
||||
<div><h2 class="title" style="clear: both">
|
||||
<a name="igraph-gpl"></a>1. THE GNU GENERAL PUBLIC LICENSE</h2></div>
|
||||
<div><p class="copyright">Copyright © 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id-1.37.2.1.3"></a><p>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
</p>
|
||||
</div></div>
|
||||
</div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.2.3">1.1. Preamble</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#sectiongpl">1.2. GNU GENERAL PUBLIC LICENSE</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.2.5">1.3. How to Apply These Terms to Your New Programs</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.2.3"></a>1.1. Preamble</h3></div></div></div>
|
||||
<p>
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
</p>
|
||||
<p>
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
</p>
|
||||
<p>
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
</p>
|
||||
<p>
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
</p>
|
||||
<p>
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
</p>
|
||||
<p>
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
</p>
|
||||
<p>
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
</p>
|
||||
<p>
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div>
|
||||
<div><h3 class="title">
|
||||
<a name="sectiongpl"></a>1.2. GNU GENERAL PUBLIC LICENSE</h3></div>
|
||||
<div><h4 class="subtitle">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</h4></div>
|
||||
</div></div>
|
||||
<p>
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
</p>
|
||||
<p>
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
</p>
|
||||
<p>
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
</p>
|
||||
<p>
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
</p>
|
||||
<p>
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
</p>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="a">
|
||||
<li class="listitem"><p>
|
||||
You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
</p></li>
|
||||
</ol></div>
|
||||
<p>
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
</p>
|
||||
<p>
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
</p>
|
||||
<p>
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
</p>
|
||||
<p>
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
</p>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="a">
|
||||
<li class="listitem"><p>
|
||||
Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
</p></li>
|
||||
</ol></div>
|
||||
<p>
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
</p>
|
||||
<p>
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
</p>
|
||||
<p>
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
</p>
|
||||
<p>
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
</p>
|
||||
<p>
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
</p>
|
||||
<p>
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
</p>
|
||||
<p>
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
</p>
|
||||
<p>
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
</p>
|
||||
<p>
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
</p>
|
||||
<p>
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
</p>
|
||||
<p>
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
</p>
|
||||
<p>
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
</p>
|
||||
<p>
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
</p>
|
||||
<p>
|
||||
NO WARRANTY
|
||||
</p>
|
||||
<p>
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
</p>
|
||||
<p>
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
</p>
|
||||
<p>
|
||||
END OF TERMS AND CONDITIONS
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.2.5"></a>1.3. How to Apply These Terms to Your New Programs</h3></div></div></div>
|
||||
<p>
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
</p>
|
||||
<p>
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
</p>
|
||||
<div class="literallayout"><p><br>
|
||||
<one line to give the program's name and a brief idea of what it does.><br>
|
||||
Copyright (C) <year> <name of author><br>
|
||||
<br>
|
||||
This program is free software; you can redistribute it and/or modify<br>
|
||||
it under the terms of the GNU General Public License as published by<br>
|
||||
the Free Software Foundation; either version 2 of the License, or<br>
|
||||
(at your option) any later version.<br>
|
||||
<br>
|
||||
This program is distributed in the hope that it will be useful,<br>
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
|
||||
GNU General Public License for more details.<br>
|
||||
<br>
|
||||
You should have received a copy of the GNU General Public License<br>
|
||||
along with this program; if not, write to the Free Software<br>
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA<br>
|
||||
</p></div>
|
||||
<p>
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
</p>
|
||||
<p>
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
</p>
|
||||
<div class="literallayout"><p><br>
|
||||
Gnomovision version 69, Copyright (C) year name of author<br>
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.<br>
|
||||
This is free software, and you are welcome to redistribute it<br>
|
||||
under certain conditions; type `show c' for details.<br>
|
||||
</p></div>
|
||||
<p>
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
</p>
|
||||
<p>
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
</p>
|
||||
<div class="literallayout"><p><br>
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program<br>
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.<br>
|
||||
<br>
|
||||
<signature of Ty Coon>, 1 April 1989<br>
|
||||
Ty Coon, President of Vice<br>
|
||||
</p></div>
|
||||
<p>
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div>
|
||||
<div><h2 class="title" style="clear: both">
|
||||
<a name="igraph-fdl"></a>2. The GNU Free Documentation License</h2></div>
|
||||
<div><p class="copyright">Copyright © 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id-1.37.3.1.3"></a><p>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
</p>
|
||||
</div></div>
|
||||
</div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.3">2.1. 0. PREAMBLE</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.4">2.2. 1. APPLICABILITY AND DEFINITIONS</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.5">2.3. 2. VERBATIM COPYING</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.6">2.4. 3. COPYING IN QUANTITY</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.7">2.5. 4. MODIFICATIONS</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.8">2.6. 5. COMBINING DOCUMENTS</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.9">2.7. 6. COLLECTIONS OF DOCUMENTS</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.10">2.8. 7. AGGREGATION WITH INDEPENDENT WORKS</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.11">2.9. 8. TRANSLATION</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.12">2.10. 9. TERMINATION</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.13">2.11. 10. FUTURE REVISIONS OF THIS LICENSE</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Licenses.html#id-1.37.3.14">2.12. G.1.1 ADDENDUM: How to use this License for your documents</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.3"></a>2.1. 0. PREAMBLE</h3></div></div></div>
|
||||
<p>
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document "free" in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
</p>
|
||||
<p>
|
||||
This License is a kind of "copyleft", which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
</p>
|
||||
<p>
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.4"></a>2.2. 1. APPLICABILITY AND DEFINITIONS</h3></div></div></div>
|
||||
<p>
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The "Document", below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as "you". You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
</p>
|
||||
<p>
|
||||
A "Modified Version" of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
</p>
|
||||
<p>
|
||||
A "Secondary Section" is a named appendix or a front-matter section of
|
||||
the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall subject
|
||||
(or to related matters) and contains nothing that could fall directly
|
||||
within that overall subject. (Thus, if the Document is in part a
|
||||
textbook of mathematics, a Secondary Section may not explain any
|
||||
mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
</p>
|
||||
<p>
|
||||
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
</p>
|
||||
<p>
|
||||
The "Cover Texts" are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
</p>
|
||||
<p>
|
||||
A "Transparent" copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not "Transparent" is called "Opaque".
|
||||
</p>
|
||||
<p>
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
or XML using a publicly available DTD, and standard-conforming simple
|
||||
HTML, PostScript or PDF designed for human modification. Examples of
|
||||
transparent image formats include PNG, XCF and JPG. Opaque formats
|
||||
include proprietary formats that can be read and edited only by
|
||||
proprietary word processors, SGML or XML for which the DTD and/or
|
||||
processing tools are not generally available, and the
|
||||
machine-generated HTML, PostScript or PDF produced by some word
|
||||
processors for output purposes only.
|
||||
</p>
|
||||
<p>
|
||||
The "Title Page" means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, "Title Page" means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
</p>
|
||||
<p>
|
||||
A section "Entitled XYZ" means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as "Acknowledgements",
|
||||
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section "Entitled XYZ" according to this definition.
|
||||
</p>
|
||||
<p>
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.5"></a>2.3. 2. VERBATIM COPYING</h3></div></div></div>
|
||||
<p>
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
</p>
|
||||
<p>
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.6"></a>2.4. 3. COPYING IN QUANTITY</h3></div></div></div>
|
||||
<p>
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
</p>
|
||||
<p>
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
</p>
|
||||
<p>
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
</p>
|
||||
<p>
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.7"></a>2.5. 4. MODIFICATIONS</h3></div></div></div>
|
||||
<p>
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="A">
|
||||
<li class="listitem"><p>
|
||||
Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Preserve all the copyright notices of the Document.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Include an unaltered copy of this License.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Preserve the section Entitled "History", Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled "History" in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the "History" section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
For any section Entitled "Acknowledgements" or "Dedications",
|
||||
Preserve the Title of the section, and preserve in the section all
|
||||
the substance and tone of each of the contributor acknowledgements
|
||||
and/or dedications given therein.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Delete any section Entitled "Endorsements". Such a section
|
||||
may not be included in the Modified Version.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Do not retitle any existing section to be Entitled "Endorsements"
|
||||
or to conflict in title with any Invariant Section.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Preserve any Warranty Disclaimers.
|
||||
</p></li>
|
||||
</ol></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
</p>
|
||||
<p>
|
||||
You may add a section Entitled "Endorsements", provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
</p>
|
||||
<p>
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
</p>
|
||||
<p>
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.8"></a>2.6. 5. COMBINING DOCUMENTS</h3></div></div></div>
|
||||
<p>
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
</p>
|
||||
<p>
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
</p>
|
||||
<p>
|
||||
In the combination, you must combine any sections Entitled "History"
|
||||
in the various original documents, forming one section Entitled
|
||||
"History"; likewise combine any sections Entitled "Acknowledgements",
|
||||
and any sections Entitled "Dedications". You must delete all sections
|
||||
Entitled "Endorsements".
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.9"></a>2.7. 6. COLLECTIONS OF DOCUMENTS</h3></div></div></div>
|
||||
<p>
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
</p>
|
||||
<p>
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.10"></a>2.8. 7. AGGREGATION WITH INDEPENDENT WORKS</h3></div></div></div>
|
||||
<p>
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an "aggregate" if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
</p>
|
||||
<p>
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.11"></a>2.9. 8. TRANSLATION</h3></div></div></div>
|
||||
<p>
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
</p>
|
||||
<p>
|
||||
If a section in the Document is Entitled "Acknowledgements",
|
||||
"Dedications", or "History", the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.12"></a>2.10. 9. TERMINATION</h3></div></div></div>
|
||||
<p>
|
||||
You may not copy, modify, sublicense, or distribute the Document except
|
||||
as expressly provided for under this License. Any other attempt to
|
||||
copy, modify, sublicense or distribute the Document is void, and will
|
||||
automatically terminate your rights under this License. However,
|
||||
parties who have received copies, or rights, from you under this
|
||||
License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.13"></a>2.11. 10. FUTURE REVISIONS OF THIS LICENSE</h3></div></div></div>
|
||||
<p>
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
http://www.gnu.org/copyleft/.
|
||||
</p>
|
||||
<p>
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="id-1.37.3.14"></a>2.12. G.1.1 ADDENDUM: How to use this License for your documents</h3></div></div></div>
|
||||
<p>
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
</p>
|
||||
<div class="literallayout"><p><br>
|
||||
Copyright (c) YEAR YOUR NAME.<br>
|
||||
Permission is granted to copy, distribute and/or modify this document<br>
|
||||
under the terms of the GNU Free Documentation License, Version 1.2<br>
|
||||
or any later version published by the Free Software Foundation;<br>
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.<br>
|
||||
A copy of the license is included in the section entitled "GNU<br>
|
||||
Free Documentation License".<br>
|
||||
</p></div>
|
||||
<p>
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the "with...Texts." line with this:
|
||||
</p>
|
||||
<div class="literallayout"><p><br>
|
||||
with the Invariant Sections being LIST THEIR TITLES, with the<br>
|
||||
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.<br>
|
||||
</p></div>
|
||||
<p>
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
</p>
|
||||
<p>
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-Glossary.html"><b>← Chapter 35. Glossary</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="ix01.html"><b>Index →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,381 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 6. Memory (de)allocation</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="next" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-Error.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-Data-structures.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Memory"></a>Chapter 6. Memory (de)allocation</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Memory.html#about-alloc-funcs">1. About allocation functions</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Memory.html#available-alloc-funcs">2. Available allocation functions</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="about-alloc-funcs"></a>1. About allocation functions</h2></div></div></div>
|
||||
<p>
|
||||
Some igraph functions return a pointer vector (<span class="type">igraph_vector_ptr_t</span>)
|
||||
containing pointers to other igraph or other data types. These data
|
||||
types are dynamically allocated and have to be deallocated
|
||||
manually when the user does not need them any more. <span class="type">igraph_vector_ptr_t</span>
|
||||
has functions to deallocate the contained pointers on its own, but in this
|
||||
case it has to be ensured that these pointers are allocated by a function
|
||||
that corresponds to the deallocator function that igraph uses.
|
||||
</p>
|
||||
<p>
|
||||
To this end, igraph exports the memory allocation functions that are used
|
||||
internally so the user of the library can ensure that the proper functions
|
||||
are used when pointers are moved between the code written by the user and
|
||||
the code of the igraph library.
|
||||
</p>
|
||||
<p>
|
||||
Additionally, the memory allocator functions used by igraph work around the
|
||||
quirks of classical <code class="constant">malloc</code>(), <code class="constant">realloc</code>() and <code class="constant">calloc</code>() implementations
|
||||
where the behaviour of allocating zero bytes is undefined. igraph allocator
|
||||
functions will always allocate at least one byte.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="available-alloc-funcs"></a>2. Available allocation functions</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Memory.html#igraph_malloc">2.1. <code class="function">igraph_malloc</code> — Allocates memory that can be safely deallocated by igraph functions.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Memory.html#igraph_calloc">2.2. <code class="function">igraph_calloc</code> — Allocates memory that can be safely deallocated by igraph functions.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Memory.html#igraph_realloc">2.3. <code class="function">igraph_realloc</code> — Reallocate memory that can be safely deallocated by igraph functions.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Memory.html#igraph_free">2.4. <code class="function">igraph_free</code> — Deallocates memory that was allocated by igraph functions.</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_malloc"></a>2.1. <code class="function">igraph_malloc</code> — Allocates memory that can be safely deallocated by igraph functions.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.7.3.2.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
void *igraph_malloc(size_t size);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function behaves like <code class="constant">malloc</code>(), but it ensures that at least one
|
||||
byte is allocated even when the caller asks for zero bytes.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>size</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Number of bytes to be allocated. Zero is treated as one byte.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Pointer to the piece of allocated memory; <code class="constant">NULL</code> if the allocation
|
||||
failed.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p><b>See also: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
<a class="link" href="igraph-Memory.html#igraph_calloc" title="2.2. igraph_calloc — Allocates memory that can be safely deallocated by igraph functions."><code class="function">igraph_calloc()</code></a>, <a class="link" href="igraph-Memory.html#igraph_realloc" title="2.3. igraph_realloc — Reallocate memory that can be safely deallocated by igraph functions."><code class="function">igraph_realloc()</code></a>, <a class="link" href="igraph-Memory.html#igraph_free" title="2.4. igraph_free — Deallocates memory that was allocated by igraph functions."><code class="function">igraph_free()</code></a>
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_calloc"></a>2.2. <code class="function">igraph_calloc</code> — Allocates memory that can be safely deallocated by igraph functions.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.7.3.3.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
void *igraph_calloc(size_t count, size_t size);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function behaves like <code class="constant">calloc</code>(), but it ensures that at least one
|
||||
byte is allocated even when the caller asks for zero bytes.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>count</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Number of items to be allocated.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>size</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Size of a single item to be allocated.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Pointer to the piece of allocated memory; <code class="constant">NULL</code> if the allocation
|
||||
failed.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p><b>See also: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
<a class="link" href="igraph-Memory.html#igraph_malloc" title="2.1. igraph_malloc — Allocates memory that can be safely deallocated by igraph functions."><code class="function">igraph_malloc()</code></a>, <a class="link" href="igraph-Memory.html#igraph_realloc" title="2.3. igraph_realloc — Reallocate memory that can be safely deallocated by igraph functions."><code class="function">igraph_realloc()</code></a>, <a class="link" href="igraph-Memory.html#igraph_free" title="2.4. igraph_free — Deallocates memory that was allocated by igraph functions."><code class="function">igraph_free()</code></a>
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_realloc"></a>2.3. <code class="function">igraph_realloc</code> — Reallocate memory that can be safely deallocated by igraph functions.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.7.3.4.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
void *igraph_realloc(void *ptr, size_t size);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function behaves like <code class="constant">realloc</code>(), but it ensures that at least one
|
||||
byte is allocated even when the caller asks for zero bytes.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>ptr</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The pointer to reallocate.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>size</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Number of bytes to be allocated.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Pointer to the piece of allocated memory; <code class="constant">NULL</code> if the allocation
|
||||
failed.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p><b>See also: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
<a class="link" href="igraph-Memory.html#igraph_free" title="2.4. igraph_free — Deallocates memory that was allocated by igraph functions."><code class="function">igraph_free()</code></a>, <a class="link" href="igraph-Memory.html#igraph_malloc" title="2.1. igraph_malloc — Allocates memory that can be safely deallocated by igraph functions."><code class="function">igraph_malloc()</code></a>
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_free"></a>2.4. <code class="function">igraph_free</code> — Deallocates memory that was allocated by igraph functions.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.7.3.5.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
void igraph_free(void *ptr);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function exposes the <code class="constant">free</code>() function used internally by igraph.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>ptr</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to the piece of memory to be deallocated.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
|
||||
Time complexity: platform dependent, ideally it should be O(1).
|
||||
|
||||
</p>
|
||||
<p><b>See also: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
<a class="link" href="igraph-Memory.html#igraph_calloc" title="2.2. igraph_calloc — Allocates memory that can be safely deallocated by igraph functions."><code class="function">igraph_calloc()</code></a>, <a class="link" href="igraph-Memory.html#igraph_malloc" title="2.1. igraph_malloc — Allocates memory that can be safely deallocated by igraph functions."><code class="function">igraph_malloc()</code></a>, <a class="link" href="igraph-Memory.html#igraph_realloc" title="2.3. igraph_realloc — Reallocate memory that can be safely deallocated by igraph functions."><code class="function">igraph_realloc()</code></a>
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-Error.html"><b>← Chapter 5. Error handling</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Data-structures.html"><b>Chapter 7. Data structure library: vector, matrix, other data types →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,274 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 30. Processes on graphs</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="next" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-Layout.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-Foreign.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Processes"></a>Chapter 30. Processes on graphs</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc"><dt><span class="section"><a href="igraph-Processes.html#epidemic-models">1. Epidemic models</a></span></dt></dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="epidemic-models"></a>1. Epidemic models</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Processes.html#igraph_sir">1.1. <code class="function">igraph_sir</code> — Performs a number of SIR epidemics model runs on a graph.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Processes.html#igraph_sir_t">1.2. <code class="function">igraph_sir_t</code> — The result of one SIR model simulation.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Processes.html#igraph_sir_destroy">1.3. <code class="function">igraph_sir_destroy</code> — Deallocates memory associated with a SIR simulation run.</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_sir"></a>1.1. <code class="function">igraph_sir</code> — Performs a number of SIR epidemics model runs on a graph.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.31.2.2.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_sir(const igraph_t *graph, igraph_real_t beta,
|
||||
igraph_real_t gamma, igraph_int_t no_sim,
|
||||
igraph_vector_ptr_t *result);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
The SIR model is a simple model from epidemiology. The individuals
|
||||
of the population might be in three states: susceptible, infected
|
||||
and recovered. Recovered people are assumed to be immune to the
|
||||
disease. Susceptibles become infected with a rate that depends on
|
||||
their number of infected neighbors. Infected people become recovered
|
||||
with a constant rate. See these parameters below.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
This function runs multiple simulations, all starting with a
|
||||
single uniformly randomly chosen infected individual. A simulation
|
||||
is stopped when no infected individuals are left.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The graph to perform the model on. For directed graphs
|
||||
edge directions are ignored and a warning is given.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>beta</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The rate of infection of an individual that is
|
||||
susceptible and has a single infected neighbor.
|
||||
The infection rate of a susceptible individual with n
|
||||
infected neighbors is n times beta. Formally
|
||||
this is the rate parameter of an exponential distribution.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>gamma</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The rate of recovery of an infected individual.
|
||||
Formally, this is the rate parameter of an exponential
|
||||
distribution.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>no_sim</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The number of simulation runs to perform.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>result</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The result of the simulation is stored here,
|
||||
in a list of <a class="link" href="igraph-Processes.html#igraph_sir_t" title="1.2. igraph_sir_t — The result of one SIR model simulation."><code class="function">igraph_sir_t</code></a> objects. To deallocate
|
||||
memory, the user needs to call <a class="link" href="igraph-Processes.html#igraph_sir_destroy" title="1.3. igraph_sir_destroy — Deallocates memory associated with a SIR simulation run."><code class="function">igraph_sir_destroy</code></a> on
|
||||
each element, before destroying the pointer vector itself
|
||||
using <a class="link" href="igraph-Data-structures.html#igraph_vector_ptr_destroy_all" title="2.17.5. igraph_vector_ptr_destroy_all — Frees all the elements and destroys the pointer vector."><code class="function">igraph_vector_ptr_destroy_all()</code></a>.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: O(no_sim * (|V| + |E| log(|V|))).
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_sir_t"></a>1.2. <code class="function">igraph_sir_t</code> — The result of one SIR model simulation.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.31.2.3.2"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
typedef struct igraph_sir_t {
|
||||
igraph_vector_t times;
|
||||
igraph_vector_int_t no_s, no_i, no_r;
|
||||
} igraph_sir_t;
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>Data structure to store the results of one simulation
|
||||
of the SIR (susceptible-infected-recovered) model on a graph.
|
||||
|
||||
It has the following members. They are all (real or integer)
|
||||
vectors, and they are of the same length.
|
||||
|
||||
</p>
|
||||
<p><b>Values: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">times</code>:</span></p></td>
|
||||
<td><p>
|
||||
A vector, the times of the events are stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">no_s</code>:</span></p></td>
|
||||
<td><p>
|
||||
An integer vector, the number of susceptibles in
|
||||
each time step is stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">no_i</code>:</span></p></td>
|
||||
<td><p>
|
||||
An integer vector, the number of infected individuals
|
||||
at each time step, is stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="constant">no_r</code>:</span></p></td>
|
||||
<td><p>
|
||||
An integer vector, the number of recovered individuals
|
||||
is stored here at each time step.</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="igraph_sir_destroy"></a>1.3. <code class="function">igraph_sir_destroy</code> — Deallocates memory associated with a SIR simulation run.</h3></div></div></div>
|
||||
<a class="indexterm" name="id-1.31.2.4.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
void igraph_sir_destroy(igraph_sir_t *sir);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>sir</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The <a class="link" href="igraph-Processes.html#igraph_sir_t" title="1.2. igraph_sir_t — The result of one SIR model simulation."><code class="function">igraph_sir_t</code></a> object storing the simulation.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-Layout.html"><b>← Chapter 29. Generating layouts for graph drawing</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Foreign.html"><b>Chapter 31. Reading and writing graphs from and to files →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,776 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 24. Vertex separators</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="next" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-Flows.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-Community.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Separators"></a>Chapter 24. Vertex separators</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Separators.html#igraph_is_separator">1. <code class="function">igraph_is_separator</code> — Would removing this set of vertices disconnect the graph?</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Separators.html#igraph_is_minimal_separator">2. <code class="function">igraph_is_minimal_separator</code> — Decides whether a set of vertices is a minimal separator.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Separators.html#igraph_all_minimal_st_separators">3. <code class="function">igraph_all_minimal_st_separators</code> — List all vertex sets that are minimal (s,t) separators for some s and t.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Separators.html#igraph_minimum_size_separators">4. <code class="function">igraph_minimum_size_separators</code> — Find all minimum size separating vertex sets.</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Separators.html#igraph_even_tarjan_reduction">5. <code class="function">igraph_even_tarjan_reduction</code> — Even-Tarjan reduction of a graph.</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_is_separator"></a>1. <code class="function">igraph_is_separator</code> — Would removing this set of vertices disconnect the graph?</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.25.2.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_is_separator(const igraph_t *graph,
|
||||
const igraph_vs_t candidate,
|
||||
igraph_bool_t *res);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
A vertex set <code class="constant">S</code> is a separator if there are vertices <code class="constant">u</code> and <code class="constant">v</code>
|
||||
in the graph such that all paths between <code class="constant">u</code> and <code class="constant">v</code> pass through
|
||||
some vertices in <code class="constant">S</code>.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph. It may be directed, but edge
|
||||
directions are ignored.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>candidate</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The candidate separator.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>res</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to a boolean variable, the result is stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: O(|V|+|E|), linear in the number vertices and edges.
|
||||
|
||||
</p>
|
||||
<div class="hideshow" onClick="toggle(this, event)">
|
||||
<div class="example">
|
||||
<a name="id-1.25.2.8.1"></a><p class="title"><b>Example 24.1. File <code class="code">examples/simple/igraph_is_separator.c</code></b></p>
|
||||
<div class="example-contents">
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
<span class="strong"><strong>#include</strong></span> <stdio.h>
|
||||
|
||||
<span class="strong"><strong>#define</strong></span> <span class="strong"><strong>FAIL</strong></span>(msg, error) <span class="strong"><strong>do</strong></span> { <span class="strong"><strong>printf</strong></span>(msg "\n") ; <span class="strong"><strong>return</strong></span> error; } <span class="strong"><strong>while</strong></span> (0)
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
|
||||
igraph_t graph;
|
||||
igraph_vector_int_t sep;
|
||||
igraph_bool_t result;
|
||||
|
||||
<span class="emphasis"><em>/* Initialize the library. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
|
||||
<span class="emphasis"><em>/* Simple star graph, remove the center */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Generators.html#igraph_star" title="4.1. igraph_star — Creates a star graph, every vertex connects only to the center.">igraph_star</a></strong></span>(&graph, 10, IGRAPH_STAR_UNDIRECTED, 0);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_separator" title="1. igraph_is_separator — Would removing this set of vertices disconnect the graph?">igraph_is_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_1" title="4.3. igraph_vss_1 — Vertex set with a single vertex (immediate version).">igraph_vss_1</a></strong></span>(0), &result);
|
||||
<span class="strong"><strong>if</strong></span> (!result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("Center of star graph failed.", 1);
|
||||
}
|
||||
|
||||
<span class="emphasis"><em>/* Same graph, but another vertex */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_separator" title="1. igraph_is_separator — Would removing this set of vertices disconnect the graph?">igraph_is_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_1" title="4.3. igraph_vss_1 — Vertex set with a single vertex (immediate version).">igraph_vss_1</a></strong></span>(6), &result);
|
||||
<span class="strong"><strong>if</strong></span> (result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("Non-center of star graph failed.", 2);
|
||||
}
|
||||
|
||||
<span class="emphasis"><em>/* Same graph, all vertices but the center */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_separator" title="1. igraph_is_separator — Would removing this set of vertices disconnect the graph?">igraph_is_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_range" title="4.5. igraph_vss_range — An interval of vertices (immediate version).">igraph_vss_range</a></strong></span>(1, 10), &result);
|
||||
<span class="strong"><strong>if</strong></span> (result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("All non-central vertices of star graph failed.", 5);
|
||||
}
|
||||
|
||||
<span class="emphasis"><em>/* Same graph, all vertices */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_separator" title="1. igraph_is_separator — Would removing this set of vertices disconnect the graph?">igraph_is_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_range" title="4.5. igraph_vss_range — An interval of vertices (immediate version).">igraph_vss_range</a></strong></span>(0, 10), &result);
|
||||
<span class="strong"><strong>if</strong></span> (result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("All vertices of star graph failed.", 6);
|
||||
}
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
|
||||
<span class="emphasis"><em>/* Karate club */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Generators.html#igraph_famous" title="8.1. igraph_famous — Create a famous graph by simply providing its name.">igraph_famous</a></strong></span>(&graph, "zachary");
|
||||
<span class="strong"><strong>igraph_vector_int_init</strong></span>(&sep, 0);
|
||||
<span class="strong"><strong>igraph_vector_int_push_back</strong></span>(&sep, 32);
|
||||
<span class="strong"><strong>igraph_vector_int_push_back</strong></span>(&sep, 33);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_separator" title="1. igraph_is_separator — Would removing this set of vertices disconnect the graph?">igraph_is_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_vector" title="4.4. igraph_vss_vector — Vertex set based on a vector (immediate version).">igraph_vss_vector</a></strong></span>(&sep), &result);
|
||||
<span class="strong"><strong>if</strong></span> (!result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("Karate network (32,33) failed", 3);
|
||||
}
|
||||
|
||||
<span class="strong"><strong>igraph_vector_int_resize</strong></span>(&sep, 5);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[0] = 8;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[1] = 9;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[2] = 19;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[3] = 30;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[4] = 31;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_separator" title="1. igraph_is_separator — Would removing this set of vertices disconnect the graph?">igraph_is_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_vector" title="4.4. igraph_vss_vector — Vertex set based on a vector (immediate version).">igraph_vss_vector</a></strong></span>(&sep), &result);
|
||||
<span class="strong"><strong>if</strong></span> (result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("Karate network (8,9,19,30,31) failed", 4);
|
||||
}
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
<span class="strong"><strong>igraph_vector_int_destroy</strong></span>(&sep);
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
<br class="example-break">
|
||||
</div>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_is_minimal_separator"></a>2. <code class="function">igraph_is_minimal_separator</code> — Decides whether a set of vertices is a minimal separator.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.25.3.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_is_minimal_separator(const igraph_t *graph,
|
||||
const igraph_vs_t candidate,
|
||||
igraph_bool_t *res);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
A vertex separator <code class="constant">S</code> is minimal is no proper subset of <code class="constant">S</code>
|
||||
is also a separator.
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph. It may be directed, but edge
|
||||
directions are ignored.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>candidate</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The candidate minimal separators.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>res</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to a boolean variable, the result is stored
|
||||
here.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: O(|V|+|E|), linear in the number vertices and edges.
|
||||
|
||||
</p>
|
||||
<div class="hideshow" onClick="toggle(this, event)">
|
||||
<div class="example">
|
||||
<a name="id-1.25.3.8.1"></a><p class="title"><b>Example 24.2. File <code class="code">examples/simple/igraph_is_minimal_separator.c</code></b></p>
|
||||
<div class="example-contents">
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
<span class="strong"><strong>#include</strong></span> <stdio.h>
|
||||
|
||||
<span class="strong"><strong>#define</strong></span> <span class="strong"><strong>FAIL</strong></span>(msg, error) <span class="strong"><strong>do</strong></span> { <span class="strong"><strong>printf</strong></span>(msg "\n") ; <span class="strong"><strong>return</strong></span> error; } <span class="strong"><strong>while</strong></span> (0)
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
|
||||
igraph_t graph;
|
||||
igraph_vector_int_t sep;
|
||||
igraph_bool_t result;
|
||||
|
||||
<span class="emphasis"><em>/* Initialize the library. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
|
||||
<span class="emphasis"><em>/* Simple star graph, remove the center */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Generators.html#igraph_star" title="4.1. igraph_star — Creates a star graph, every vertex connects only to the center.">igraph_star</a></strong></span>(&graph, 10, IGRAPH_STAR_UNDIRECTED, 0);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_minimal_separator" title="2. igraph_is_minimal_separator — Decides whether a set of vertices is a minimal separator.">igraph_is_minimal_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_1" title="4.3. igraph_vss_1 — Vertex set with a single vertex (immediate version).">igraph_vss_1</a></strong></span>(0), &result);
|
||||
<span class="strong"><strong>if</strong></span> (!result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("Center of star graph failed.", 1);
|
||||
}
|
||||
|
||||
<span class="emphasis"><em>/* Same graph, but another vertex */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_minimal_separator" title="2. igraph_is_minimal_separator — Decides whether a set of vertices is a minimal separator.">igraph_is_minimal_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_1" title="4.3. igraph_vss_1 — Vertex set with a single vertex (immediate version).">igraph_vss_1</a></strong></span>(6), &result);
|
||||
<span class="strong"><strong>if</strong></span> (result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("Non-center of star graph failed.", 2);
|
||||
}
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
|
||||
<span class="emphasis"><em>/* Karate club */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Generators.html#igraph_famous" title="8.1. igraph_famous — Create a famous graph by simply providing its name.">igraph_famous</a></strong></span>(&graph, "zachary");
|
||||
<span class="strong"><strong>igraph_vector_int_init</strong></span>(&sep, 0);
|
||||
<span class="strong"><strong>igraph_vector_int_push_back</strong></span>(&sep, 32);
|
||||
<span class="strong"><strong>igraph_vector_int_push_back</strong></span>(&sep, 33);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_minimal_separator" title="2. igraph_is_minimal_separator — Decides whether a set of vertices is a minimal separator.">igraph_is_minimal_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_vector" title="4.4. igraph_vss_vector — Vertex set based on a vector (immediate version).">igraph_vss_vector</a></strong></span>(&sep), &result);
|
||||
<span class="strong"><strong>if</strong></span> (!result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("Karate network (32,33) failed", 3);
|
||||
}
|
||||
|
||||
<span class="strong"><strong>igraph_vector_int_resize</strong></span>(&sep, 5);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[0] = 8;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[1] = 9;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[2] = 19;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[3] = 30;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(sep)[4] = 31;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_minimal_separator" title="2. igraph_is_minimal_separator — Decides whether a set of vertices is a minimal separator.">igraph_is_minimal_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_vector" title="4.4. igraph_vss_vector — Vertex set based on a vector (immediate version).">igraph_vss_vector</a></strong></span>(&sep), &result);
|
||||
<span class="strong"><strong>if</strong></span> (result) {
|
||||
<span class="strong"><strong>FAIL</strong></span>("Karate network (8,9,19,30,31) failed", 4);
|
||||
}
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
<span class="strong"><strong>igraph_vector_int_destroy</strong></span>(&sep);
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
<br class="example-break">
|
||||
</div>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_all_minimal_st_separators"></a>3. <code class="function">igraph_all_minimal_st_separators</code> — List all vertex sets that are minimal (s,t) separators for some s and t.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.25.4.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_all_minimal_st_separators(
|
||||
const igraph_t *graph, igraph_vector_int_list_t *separators
|
||||
);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function lists all vertex sets that are minimal (s,t)
|
||||
separators for some (s,t) vertex pair.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
Note that some vertex sets returned by this function may not be minimal
|
||||
with respect to disconnecting the graph (or increasing the number of
|
||||
connected components). Take for example the 5-vertex graph with edges
|
||||
<code class="literal">0-1-2-3-4-1</code>. This function returns the vertex sets
|
||||
<code class="literal">{1}</code>, <code class="literal">{2,4}</code> and <code class="literal">{1,3}</code>.
|
||||
Notice that <code class="literal">{1,3}</code> is not minimal with respect to disconnecting
|
||||
the graph, as <code class="literal">{1}</code> would be sufficient for that. However, it is
|
||||
minimal with respect to separating vertices <code class="constant">2</code> and <code class="constant">4</code>.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
See more about the implemented algorithm in
|
||||
Anne Berry, Jean-Paul Bordat and Olivier Cogis: Generating All the
|
||||
Minimal Separators of a Graph, In: Peter Widmayer, Gabriele Neyer
|
||||
and Stephan Eidenbenz (editors): Graph-theoretic concepts in
|
||||
computer science, 1665, 167--172, 1999. Springer.
|
||||
<a class="ulink" href="https://doi.org/10.1007/3-540-46784-X_17" target="_top">https://doi.org/10.1007/3-540-46784-X_17</a>
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph. It may be directed, but edge
|
||||
directions are ignored.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>separators</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to a list of integer vectors, the separators
|
||||
will be stored here.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p><b>See also: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
<a class="link" href="igraph-Separators.html#igraph_minimum_size_separators" title="4. igraph_minimum_size_separators — Find all minimum size separating vertex sets."><code class="function">igraph_minimum_size_separators()</code></a>
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: O(n|V|^3), |V| is the number of vertices, n is the
|
||||
number of separators.
|
||||
|
||||
</p>
|
||||
<div class="hideshow" onClick="toggle(this, event)">
|
||||
<div class="example">
|
||||
<a name="id-1.25.4.12.1"></a><p class="title"><b>Example 24.3. File <code class="code">examples/simple/igraph_minimal_separators.c</code></b></p>
|
||||
<div class="example-contents">
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
<span class="strong"><strong>#include</strong></span> <stdio.h>
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
igraph_t graph;
|
||||
igraph_vector_int_list_t separators;
|
||||
igraph_int_t i, n;
|
||||
|
||||
<span class="emphasis"><em>/* Initialize the library. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Generators.html#igraph_famous" title="8.1. igraph_famous — Create a famous graph by simply providing its name.">igraph_famous</a></strong></span>(&graph, "zachary");
|
||||
<span class="strong"><strong>igraph_vector_int_list_init</strong></span>(&separators, 0);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_all_minimal_st_separators" title="3. igraph_all_minimal_st_separators — List all vertex sets that are minimal (s,t) separators for some s and t.">igraph_all_minimal_st_separators</a></strong></span>(&graph, &separators);
|
||||
|
||||
n = <span class="strong"><strong>igraph_vector_int_list_size</strong></span>(&separators);
|
||||
<span class="strong"><strong>for</strong></span> (i = 0; i < n; i++) {
|
||||
igraph_bool_t res;
|
||||
igraph_vector_int_t *sep = <span class="strong"><strong>igraph_vector_int_list_get_ptr</strong></span>(&separators, i);
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_is_separator" title="1. igraph_is_separator — Would removing this set of vertices disconnect the graph?">igraph_is_separator</a></strong></span>(&graph, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_vector" title="4.4. igraph_vss_vector — Vertex set based on a vector (immediate version).">igraph_vss_vector</a></strong></span>(sep), &res);
|
||||
<span class="strong"><strong>if</strong></span> (!res) {
|
||||
<span class="strong"><strong>printf</strong></span>("Vertex set %" IGRAPH_PRId " is not a separator!\n", i);
|
||||
<span class="strong"><strong>igraph_vector_int_print</strong></span>(sep);
|
||||
<span class="strong"><strong>return</strong></span> 1;
|
||||
}
|
||||
}
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
<span class="strong"><strong>igraph_vector_int_list_destroy</strong></span>(&separators);
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
<br class="example-break">
|
||||
</div>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_minimum_size_separators"></a>4. <code class="function">igraph_minimum_size_separators</code> — Find all minimum size separating vertex sets.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.25.5.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_minimum_size_separators(
|
||||
const igraph_t *graph, igraph_vector_int_list_t *separators
|
||||
);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This function lists all separator vertex sets of minimum size.
|
||||
A vertex set is a separator if its removal disconnects the graph.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
If the graph is already disconnected, no separators are returned.
|
||||
Note that this convention differs from that used by some other
|
||||
funtions such as <a class="link" href="igraph-Separators.html#igraph_all_minimal_st_separators" title="3. igraph_all_minimal_st_separators — List all vertex sets that are minimal (s,t) separators for some s and t."><code class="function">igraph_all_minimal_st_separators()</code></a>.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
Complete graphs have no vertex separators.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
The implementation is based on the following paper:
|
||||
Arkady Kanevsky: Finding all minimum-size separating vertex sets in
|
||||
a graph, Networks 23, 533--541, 1993.
|
||||
<a class="ulink" href="https://doi.org/10.1002/net.3230230604" target="_top">https://doi.org/10.1002/net.3230230604</a>
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
The input graph, which must be undirected.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>separators</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
An initialized list of integer vectors, the separators
|
||||
are stored here. It is a list of pointers to <span class="type">igraph_vector_int_t</span>
|
||||
objects. Each vector will contain the IDs of the vertices in
|
||||
the separator. The separators are returned in an arbitrary order.
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: TODO.
|
||||
|
||||
</p>
|
||||
<div class="hideshow" onClick="toggle(this, event)">
|
||||
<div class="example">
|
||||
<a name="id-1.25.5.11.1"></a><p class="title"><b>Example 24.4. File <code class="code">examples/simple/igraph_minimum_size_separators.c</code></b></p>
|
||||
<div class="example-contents">
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
igraph_t g;
|
||||
igraph_vector_int_list_t sep;
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Generators.html#igraph_small" title="2.2. igraph_small — Shorthand to create a small graph, giving the edges as arguments.">igraph_small</a></strong></span>(&g, 7, IGRAPH_UNDIRECTED,
|
||||
1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0,
|
||||
-1);
|
||||
<span class="strong"><strong>igraph_vector_int_list_init</strong></span>(&sep, 0);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_minimum_size_separators" title="4. igraph_minimum_size_separators — Find all minimum size separating vertex sets.">igraph_minimum_size_separators</a></strong></span>(&g, &sep);
|
||||
|
||||
<span class="strong"><strong>for</strong></span> (igraph_int_t i = 0; i < <span class="strong"><strong>igraph_vector_int_list_size</strong></span>(&sep); i++) {
|
||||
igraph_vector_int_t* v = <span class="strong"><strong>igraph_vector_int_list_get_ptr</strong></span>(&sep, i);
|
||||
<span class="strong"><strong>igraph_vector_int_print</strong></span>(v);
|
||||
}
|
||||
|
||||
<span class="strong"><strong>igraph_vector_int_list_destroy</strong></span>(&sep);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&g);
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
<br class="example-break">
|
||||
</div>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="igraph_even_tarjan_reduction"></a>5. <code class="function">igraph_even_tarjan_reduction</code> — Even-Tarjan reduction of a graph.</h2></div></div></div>
|
||||
<a class="indexterm" name="id-1.25.6.2"></a><p>
|
||||
</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
igraph_error_t igraph_even_tarjan_reduction(const igraph_t *graph, igraph_t *graphbar,
|
||||
igraph_vector_t *capacity);
|
||||
</pre></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
A digraph is created with twice as many vertices and edges. For each
|
||||
original vertex <code class="constant">i</code>, two vertices <code class="literal">i' = i</code> and
|
||||
<code class="literal">i'' = i' + n</code> are created,
|
||||
with a directed edge from <code class="literal">i'</code> to <code class="literal">i''</code>.
|
||||
For each original directed edge from <code class="constant">i</code> to <code class="constant">j</code>, two new edges are created,
|
||||
from <code class="literal">i'</code> to <code class="literal">j''</code> and from <code class="literal">i''</code>
|
||||
to <code class="literal">j'</code>.
|
||||
|
||||
</p>
|
||||
<p>This reduction is used in the paper (observation 2):
|
||||
Arkady Kanevsky: Finding all minimum-size separating vertex sets in
|
||||
a graph, Networks 23, 533--541, 1993.
|
||||
|
||||
</p>
|
||||
<p>The original paper where this reduction was conceived is
|
||||
Shimon Even and R. Endre Tarjan: Network Flow and Testing Graph
|
||||
Connectivity, SIAM J. Comput., 4(4), 507–518.
|
||||
<a class="ulink" href="https://doi.org/10.1137/0204043" target="_top">https://doi.org/10.1137/0204043</a>
|
||||
|
||||
</p>
|
||||
<p><b>Arguments: </b>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graph</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
A graph. Although directness is not checked, this function
|
||||
is commonly used only on directed graphs.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>graphbar</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to a new directed graph that will contain the
|
||||
reduction, with twice as many vertices and edges.
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><em class="parameter"><code>capacity</code></em>:</span></p></td>
|
||||
<td><p>
|
||||
Pointer to an initialized vector or a null pointer. If
|
||||
not a null pointer, then it will be filled the capacity from
|
||||
the reduction: the first |E| elements are 1, the remaining |E|
|
||||
are equal to |V| (which is used to indicate infinity).
|
||||
</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><b>Returns: </b></p>
|
||||
<div class="variablelist"><table border="0" class="variablelist">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><em class="parameter"><code></code></em></span></p></td>
|
||||
<td><p>
|
||||
Error code.
|
||||
</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
Time complexity: O(|E|+|V|).
|
||||
|
||||
</p>
|
||||
<div class="hideshow" onClick="toggle(this, event)">
|
||||
<div class="example">
|
||||
<a name="id-1.25.6.10.1"></a><p class="title"><b>Example 24.5. File <code class="code">examples/simple/even_tarjan.c</code></b></p>
|
||||
<div class="example-contents">
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
<span class="strong"><strong>#include</strong></span> <limits.h>
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
|
||||
igraph_t g, gbar;
|
||||
igraph_int_t k1, k2 = INT_MAX;
|
||||
igraph_real_t tmpk;
|
||||
igraph_int_t i, j, n;
|
||||
<a class="link" href="igraph-Flows.html#igraph_maxflow_stats_t" title="1.4. igraph_maxflow_stats_t — Data structure holding statistics from the push-relabel maximum flow solver.">igraph_maxflow_stats_t</a> stats;
|
||||
|
||||
<span class="emphasis"><em>/* Initialize the library. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Generators.html#igraph_famous" title="8.1. igraph_famous — Create a famous graph by simply providing its name.">igraph_famous</a></strong></span>(&g, "meredith");
|
||||
<span class="strong"><strong><a class="link" href="igraph-Separators.html#igraph_even_tarjan_reduction" title="5. igraph_even_tarjan_reduction — Even-Tarjan reduction of a graph.">igraph_even_tarjan_reduction</a></strong></span>(&g, &gbar, <span class="emphasis"><em>/*capacity=*/</em></span> NULL);
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Flows.html#igraph_vertex_connectivity" title="3.4. igraph_vertex_connectivity — The vertex connectivity of a graph.">igraph_vertex_connectivity</a></strong></span>(&g, &k1, <span class="emphasis"><em>/* checks= */</em></span> false);
|
||||
|
||||
n = <span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_vcount" title="5.2.1. igraph_vcount — The number of vertices in a graph.">igraph_vcount</a></strong></span>(&g);
|
||||
<span class="strong"><strong>for</strong></span> (i = 0; i < n; i++) {
|
||||
<span class="strong"><strong>for</strong></span> (j = i + 1; j < n; j++) {
|
||||
igraph_bool_t conn;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Structural.html#igraph_are_adjacent" title="1.1. igraph_are_adjacent — Decides whether two vertices are adjacent.">igraph_are_adjacent</a></strong></span>(&g, i, j, &conn);
|
||||
<span class="strong"><strong>if</strong></span> (conn) {
|
||||
<span class="strong"><strong>continue</strong></span>;
|
||||
}
|
||||
<span class="strong"><strong><a class="link" href="igraph-Flows.html#igraph_maxflow_value" title="1.2. igraph_maxflow_value — Maximum flow in a network with the push/relabel algorithm.">igraph_maxflow_value</a></strong></span>(&gbar, &tmpk,
|
||||
<span class="emphasis"><em>/* source= */</em></span> i + n,
|
||||
<span class="emphasis"><em>/* target= */</em></span> j,
|
||||
<span class="emphasis"><em>/* capacity= */</em></span> 0,
|
||||
&stats);
|
||||
<span class="strong"><strong>if</strong></span> (tmpk < k2) {
|
||||
k2 = tmpk;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&gbar);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&g);
|
||||
|
||||
<span class="strong"><strong>if</strong></span> (k1 != k2) {
|
||||
<span class="strong"><strong>printf</strong></span>("k1 = %" IGRAPH_PRId " while k2 = %" IGRAPH_PRId "\n", k1, k2);
|
||||
<span class="strong"><strong>return</strong></span> 1;
|
||||
}
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
<br class="example-break">
|
||||
</div>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-Flows.html"><b>← Chapter 23. Maximum flows, minimum cuts and related measures</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Community.html"><b>Chapter 25. Detecting community structure →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,520 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chapter 3. Tutorial</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="up" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="prev" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="next" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="navigation-header mb-4" width="100%" summary="Navigation header"><div class="btn-group">
|
||||
<a accesskey="p" class="btn btn-light" href="igraph-Installation.html"><i class="fa fa-chevron-left"></i>
|
||||
Previous
|
||||
</a><a accesskey="h" class="btn btn-light" href="index.html"><i class="fa fa-home"></i>
|
||||
Home
|
||||
</a><a accesskey="n" class="btn btn-light" href="igraph-Basic.html"><i class="fa fa-chevron-right"></i>
|
||||
Next
|
||||
</a>
|
||||
</div></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div><div><h1 class="title">
|
||||
<a name="igraph-Tutorial"></a>Chapter 3. Tutorial</h1></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Tutorial.html#tut-lesson-1">1. Compiling programs using igraph</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Tutorial.html#tut-lesson-2">2. Creating your first graphs</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Tutorial.html#tut-lesson-3">3. Calculating various properties of graphs</a></span></dt>
|
||||
</dl></div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="tut-lesson-1"></a>1. Compiling programs using igraph</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="section"><a href="igraph-Tutorial.html#tut-lesson-1-compiling-with-cmake">1.1. Compiling with CMake</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Tutorial.html#tut-lesson-1-compiling-without-cmake">1.2. Compiling without CMake</a></span></dt>
|
||||
<dt><span class="section"><a href="igraph-Tutorial.html#tut-lesson-1-running-the-program">1.3. Running the program</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
The following short example program demonstrates the basic usage of
|
||||
the <span class="command"><strong>igraph</strong></span> library. Save it into a file named
|
||||
<code class="filename">igraph_test.c</code>.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
igraph_int_t num_vertices = 1000;
|
||||
igraph_int_t num_edges = 1000;
|
||||
igraph_real_t diameter, mean_degree;
|
||||
igraph_t graph;
|
||||
|
||||
<span class="emphasis"><em>/* Initialize the library. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
|
||||
<span class="emphasis"><em>/* Ensure identical results across runs. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Random.html#igraph_rng_seed" title="3.3. igraph_rng_seed — Seeds a random number generator.">igraph_rng_seed</a></strong></span>(<span class="strong"><strong><a class="link" href="igraph-Random.html#igraph_rng_default" title="2.1. igraph_rng_default — Query the default random number generator.">igraph_rng_default</a></strong></span>(), 42);
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Games.html#igraph_erdos_renyi_game_gnm" title="1.1. igraph_erdos_renyi_game_gnm — Generates a random (Erdős-Rényi) graph with a fixed number of edges.">igraph_erdos_renyi_game_gnm</a></strong></span>(
|
||||
&graph, num_vertices, num_edges,
|
||||
IGRAPH_UNDIRECTED, IGRAPH_SIMPLE_SW, IGRAPH_EDGE_UNLABELED);
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Structural.html#igraph_diameter" title="3.22. igraph_diameter — Calculates the weighted diameter of a graph using Dijkstra's algorithm.">igraph_diameter</a></strong></span>(
|
||||
&graph, <span class="emphasis"><em>/* weights = */</em></span> NULL,
|
||||
&diameter,
|
||||
<span class="emphasis"><em>/* from = */</em></span> NULL, <span class="emphasis"><em>/* to = */</em></span> NULL,
|
||||
<span class="emphasis"><em>/* vertex_path = */</em></span> NULL, <span class="emphasis"><em>/* edge_path = */</em></span> NULL,
|
||||
IGRAPH_UNDIRECTED, <span class="emphasis"><em>/* unconn= */</em></span> true);
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Structural.html#igraph_mean_degree" title="26.2. igraph_mean_degree — The mean degree of a graph.">igraph_mean_degree</a></strong></span>(&graph, &mean_degree, IGRAPH_LOOPS);
|
||||
<span class="strong"><strong>printf</strong></span>("Diameter of a random graph with average degree %g: %g\n",
|
||||
mean_degree, diameter);
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
This example illustrates a couple of points:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>
|
||||
First, programs
|
||||
using the <span class="command"><strong>igraph</strong></span> library should include the
|
||||
<code class="filename">igraph.h</code> header
|
||||
file. Note that while igraph installs several sub-headers, the organization of these may change
|
||||
without notice. Only use <code class="filename">igraph.h</code> in your projects, not any of the sub-headers.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Second, the library must be initialized using
|
||||
<a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library."><code class="function">igraph_setup()</code></a>
|
||||
before use.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Third, <span class="command"><strong>igraph</strong></span> uses the
|
||||
<span class="type">igraph_int_t</span> type for integers instead of
|
||||
<span class="type">int</span> or <span class="type">long int</span>, and it also uses the
|
||||
<span class="type">igraph_real_t</span> type for real numbers instead of
|
||||
<span class="type">double</span>. Depending on how <span class="command"><strong>igraph</strong></span> was compiled, and whether you are
|
||||
using a 32-bit or 64-bit system, <span class="type">igraph_int_t</span> may be a 32-bit
|
||||
or 64-bit integer.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Fourth, <span class="command"><strong>igraph</strong></span> graph objects are represented by the <span class="type">igraph_t</span> data
|
||||
type.
|
||||
</p></li>
|
||||
<li class="listitem"><p>
|
||||
Fifth, the <a class="link" href="igraph-Games.html#igraph_erdos_renyi_game_gnm" title="1.1. igraph_erdos_renyi_game_gnm — Generates a random (Erdős-Rényi) graph with a fixed number of edges."><code class="function">igraph_erdos_renyi_game_gnm()</code></a>
|
||||
creates a graph and <a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object."><code class="function">igraph_destroy()</code></a>
|
||||
destroys it, i.e. deallocates the memory associated to it.
|
||||
</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
For compiling this program you need a C compiler. Optionally,
|
||||
<a class="ulink" href="https://cmake.org" target="_top">CMake</a> can be used to automate the compilation.
|
||||
</p>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="tut-lesson-1-compiling-with-cmake"></a>1.1. Compiling with CMake</h3></div></div></div>
|
||||
<p>
|
||||
It is convenient to use CMake because it can automatically discover the
|
||||
necessary compilation flags on all operating systems. Many IDEs support
|
||||
CMake, and can work with CMake projects directly. To create a CMake project
|
||||
for this example program, create a file name <code class="filename">CMakeLists.txt</code> with the
|
||||
following contents:
|
||||
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
project(igraph_test)
|
||||
|
||||
find_package(igraph REQUIRED)
|
||||
|
||||
add_executable(igraph_test igraph_test.c)
|
||||
target_link_libraries(igraph_test PUBLIC igraph::igraph)
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
To compile the project, create a new directory called <code class="filename">build</code> in
|
||||
the root of the <span class="command"><strong>igraph</strong></span> source tree, and switch to it:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
mkdir build
|
||||
cd build
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
Run CMake to configure the project:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
cmake ..
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
If <span class="command"><strong>igraph</strong></span> was installed at a non-standard location, specify its prefix
|
||||
using the <code class="option">-DCMAKE_PREFIX_PATH=...</code> option. The prefix must be
|
||||
the same directory that was specified as the <code class="option">CMAKE_INSTALL_PREFIX</code>
|
||||
when compiling igraph.
|
||||
</p>
|
||||
<p>
|
||||
If configuration has succeeded, build the program using
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
cmake --build .
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
|
||||
<h3 class="title">C++ must be enabled in igraph projects</h3>
|
||||
<p>Parts of <span class="command"><strong>igraph</strong></span> are implemented in C++; therefore, any CMake target that
|
||||
depends on <span class="command"><strong>igraph</strong></span> should use the C++ linker. Furthermore, OpenMP support in
|
||||
igraph works correctly only if C++ is enabled in the CMake project. The script
|
||||
that finds <span class="command"><strong>igraph</strong></span> on the host machine will throw an error if C++ support is
|
||||
not enabled in the CMake project.</p>
|
||||
<p>C++ support is enabled by default when no languages are explicitly
|
||||
specified in CMake's <a class="ulink" href="https://cmake.org/cmake/help/latest/command/project.html" target="_top"><code class="code">project</code></a>
|
||||
command, e.g. <code class="code">project(igraph_test)</code>. If you do specify some languages explicitly,
|
||||
make sure to also include <code class="code">CXX</code>, e.g. <code class="code">project(igraph_test C CXX)</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="tut-lesson-1-compiling-without-cmake"></a>1.2. Compiling without CMake</h3></div></div></div>
|
||||
<p>
|
||||
On most Unix-like systems, the default C compiler is called <span class="command"><strong>cc</strong></span>.
|
||||
To compile the test program, you will need a command similar to the following:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
cc igraph_test.c -I/usr/local/include/igraph -L/usr/local/lib -ligraph -o igraph_test
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
The exact form depends on where <span class="command"><strong>igraph</strong></span> was installed on your
|
||||
system, whether it was compiled as a shared or static library, and the external
|
||||
libraries it was linked to. The directory after the <code class="option">-I</code> switch
|
||||
is the one containing the <code class="filename">igraph.h</code> file, while the one
|
||||
following <code class="option">-L</code> should contain the library file itself, usually a
|
||||
file called <code class="filename">libigraph.a</code> (static library on macOS and
|
||||
Linux), <code class="filename">libigraph.so</code> (shared library on Linux),
|
||||
<code class="filename">libigraph.dylib</code> (shared library on macOS),
|
||||
<code class="filename">igraph.lib</code> (static library on Windows) or
|
||||
<code class="filename">igraph.dll</code> (shared library on Windows). If
|
||||
<span class="command"><strong>igraph</strong></span> was compiled as a static library, it is also
|
||||
necessary to manually link to all of its dependencies.
|
||||
</p>
|
||||
<p>
|
||||
If your system has the <span class="command"><strong>pkg-config</strong></span> utility you are
|
||||
likely to get the necessary compile options by issuing the command
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
pkg-config --libs --cflags igraph
|
||||
</pre>
|
||||
<p>
|
||||
(if <span class="command"><strong>igraph</strong></span> was built as a shared library) or
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
pkg-config --static --libs --cflags igraph
|
||||
</pre>
|
||||
<p>
|
||||
(if <span class="command"><strong>igraph</strong></span> was built as a static library).
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="tut-lesson-1-running-the-program"></a>1.3. Running the program</h3></div></div></div>
|
||||
<p>
|
||||
On most systems, the executable can be run by simply typing its name like this:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
./igraph_test
|
||||
</pre>
|
||||
<p>
|
||||
If you use dynamic linking and the <span class="command"><strong>igraph</strong></span>
|
||||
library is not installed in a standard place, you may need to add its location to the
|
||||
<code class="envar">LD_LIBRARY_PATH</code> (Linux), <code class="envar">DYLD_LIBRARY_PATH</code> (macOS)
|
||||
or <code class="envar">PATH</code> (Windows) environment variables. This is typically necessary
|
||||
on Windows systems.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="tut-lesson-2"></a>2. Creating your first graphs</h2></div></div></div>
|
||||
<p>
|
||||
The functions generating graph objects are called graph
|
||||
generators. Stochastic (i.e. randomized) graph generators are called
|
||||
<span class="quote">“<span class="quote">games</span>”</span>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="command"><strong>igraph</strong></span> can handle directed and undirected graphs. Most graph
|
||||
generators are able to create both types of graphs and most other
|
||||
functions are usually also capable of handling
|
||||
both. E.g., <a class="link" href="igraph-Structural.html#igraph_get_shortest_paths" title="3.8. igraph_get_shortest_paths — Shortest paths from a vertex."><code class="function">igraph_get_shortest_paths()</code></a>,
|
||||
which calculates shortest paths from a vertex to other vertices, can calculate
|
||||
directed or undirected paths.
|
||||
</p>
|
||||
<p>
|
||||
<span class="command"><strong>igraph</strong></span> has sophisticated ways for creating graphs. The simplest
|
||||
graphs are deterministic regular structures like star graphs
|
||||
(<a class="link" href="igraph-Generators.html#igraph_star" title="4.1. igraph_star — Creates a star graph, every vertex connects only to the center."><code class="function">igraph_star()</code></a>),
|
||||
cycle graphs (<a class="link" href="igraph-Generators.html#igraph_cycle_graph" title="4.9. igraph_cycle_graph — A cycle graph C_n."><code class="function">igraph_cycle_graph()</code></a>), lattices
|
||||
(<a class="link" href="igraph-Generators.html#igraph_square_lattice" title="4.4. igraph_square_lattice — Arbitrary dimensional square lattices."><code class="function">igraph_square_lattice()</code></a>) or trees
|
||||
(<a class="link" href="igraph-Generators.html#igraph_kary_tree" title="5.1. igraph_kary_tree — Creates a k-ary tree in which almost all vertices have k children."><code class="function">igraph_kary_tree()</code></a>), and many more.
|
||||
</p>
|
||||
<p>
|
||||
The following example creates an undirected regular circular lattice,
|
||||
adds some random edges to it and calculates the average length of
|
||||
shortest paths between all pairs of vertices in the graph before and
|
||||
after adding the random edges. (The message is that some random edges
|
||||
can reduce path lengths a lot.)
|
||||
</p>
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
igraph_t graph;
|
||||
igraph_vector_int_t dimvector;
|
||||
igraph_vector_int_t edges;
|
||||
igraph_vector_bool_t periodic;
|
||||
igraph_real_t avg_path_len;
|
||||
|
||||
<span class="emphasis"><em>/* Initialize the library. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
|
||||
<span class="strong"><strong>igraph_vector_int_init</strong></span>(&dimvector, 2);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(dimvector)[0] = 30;
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(dimvector)[1] = 30;
|
||||
|
||||
<span class="strong"><strong>igraph_vector_bool_init</strong></span>(&periodic, 2);
|
||||
<span class="strong"><strong>igraph_vector_bool_fill</strong></span>(&periodic, true);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Generators.html#igraph_square_lattice" title="4.4. igraph_square_lattice — Arbitrary dimensional square lattices.">igraph_square_lattice</a></strong></span>(&graph, &dimvector, 0, IGRAPH_UNDIRECTED,
|
||||
<span class="emphasis"><em>/* mutual= */</em></span> false, &periodic);
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Structural.html#igraph_average_path_length" title="3.20. igraph_average_path_length — The average shortest path length between all vertex pairs.">igraph_average_path_length</a></strong></span>(&graph, NULL, &avg_path_len, NULL,
|
||||
IGRAPH_UNDIRECTED, <span class="emphasis"><em>/* unconn= */</em></span> true);
|
||||
<span class="strong"><strong>printf</strong></span>("Average path length (lattice): %g\n", (double) avg_path_len);
|
||||
|
||||
<span class="emphasis"><em>/* Seed the RNG to ensure identical results across runs. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Random.html#igraph_rng_seed" title="3.3. igraph_rng_seed — Seeds a random number generator.">igraph_rng_seed</a></strong></span>(<span class="strong"><strong><a class="link" href="igraph-Random.html#igraph_rng_default" title="2.1. igraph_rng_default — Query the default random number generator.">igraph_rng_default</a></strong></span>(), 42);
|
||||
|
||||
<span class="strong"><strong>igraph_vector_int_init</strong></span>(&edges, 20);
|
||||
<span class="strong"><strong>for</strong></span> (igraph_int_t i = 0; i < <span class="strong"><strong>igraph_vector_int_size</strong></span>(&edges); i++) {
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector.">VECTOR</a></strong></span>(edges)[i] = <span class="strong"><strong>RNG_INTEGER</strong></span>(0, <span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_vcount" title="5.2.1. igraph_vcount — The number of vertices in a graph.">igraph_vcount</a></strong></span>(&graph) - 1);
|
||||
}
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_add_edges" title="5.3.2. igraph_add_edges — Adds edges to a graph object.">igraph_add_edges</a></strong></span>(&graph, &edges, NULL);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Structural.html#igraph_average_path_length" title="3.20. igraph_average_path_length — The average shortest path length between all vertex pairs.">igraph_average_path_length</a></strong></span>(&graph, NULL, &avg_path_len, NULL,
|
||||
IGRAPH_UNDIRECTED, <span class="emphasis"><em>/* unconn= */</em></span> true);
|
||||
<span class="strong"><strong>printf</strong></span>("Average path length (randomized lattice): %g\n", (double) avg_path_len);
|
||||
|
||||
<span class="strong"><strong>igraph_vector_bool_destroy</strong></span>(&periodic);
|
||||
<span class="strong"><strong>igraph_vector_int_destroy</strong></span>(&dimvector);
|
||||
<span class="strong"><strong>igraph_vector_int_destroy</strong></span>(&edges);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
This example illustrates some new points. <span class="command"><strong>igraph</strong></span> uses
|
||||
<a class="link" href="igraph-Data-structures.html#igraph_vector_t" title="2.1. About igraph_vector_t objects"><span class="type">igraph_vector_t</span></a>
|
||||
and its related types (<span class="type">igraph_vector_int_t</span>, <span class="type">igraph_vector_bool_t</span>
|
||||
and so on) instead of plain C arrays. <span class="type">igraph_vector_t</span> is superior to
|
||||
regular arrays in almost every sense. Vectors are created by the
|
||||
<a class="link" href="igraph-Data-structures.html#igraph_vector_init" title="2.2.1. igraph_vector_init — Initializes a vector object (constructor)."><code class="function">igraph_vector_init()</code></a>
|
||||
function and, like graphs, they should be destroyed if not
|
||||
needed any more by calling
|
||||
<a class="link" href="igraph-Data-structures.html#igraph_vector_destroy" title="2.2.5. igraph_vector_destroy — Destroys a vector object."><code class="function">igraph_vector_destroy()</code></a>
|
||||
on them. A vector can be indexed by the
|
||||
<a class="link" href="igraph-Data-structures.html#VECTOR" title="2.4.1. VECTOR — Accessing an element of a vector."><code class="function">VECTOR()</code></a> function
|
||||
(right now it is a macro). The elements of a vector are of type <span class="type">igraph_real_t</span>
|
||||
for <a class="link" href="igraph-Data-structures.html#igraph_vector_t" title="2.1. About igraph_vector_t objects"><span class="type">igraph_vector_t</span></a>,
|
||||
and of type <span class="type">igraph_int_t</span> for <span class="type">igraph_vector_int_t</span>.
|
||||
As you might expect, <span class="type">igraph_vector_bool_t</span> holds
|
||||
<span class="type">igraph_bool_t</span> values. Vectors can be resized and most <span class="command"><strong>igraph</strong></span>
|
||||
functions returning the result in a vector automatically resize it to the size they need.
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="igraph-Generators.html#igraph_square_lattice" title="4.4. igraph_square_lattice — Arbitrary dimensional square lattices."><code class="function">igraph_square_lattice()</code></a>
|
||||
takes an integer vector argument specifying the dimensions of
|
||||
the lattice. In this example we generate a 30x30 two dimensional
|
||||
periodic lattice. See the documentation of
|
||||
<a class="link" href="igraph-Generators.html#igraph_square_lattice" title="4.4. igraph_square_lattice — Arbitrary dimensional square lattices."><code class="function">igraph_square_lattice()</code></a> in
|
||||
the reference manual for the other arguments.
|
||||
</p>
|
||||
<p>
|
||||
The vertices in a graph are identified by a <span class="emphasis"><em>vertex ID</em></span>, an integer between
|
||||
<code class="code">0</code> and <code class="code">n - 1</code>, where <code class="code">n</code> is the number of vertices in the graph.
|
||||
The vertex count can be retrieved using <a class="link" href="igraph-Basic.html#igraph_vcount" title="5.2.1. igraph_vcount — The number of vertices in a graph."><code class="function">igraph_vcount()</code></a>,
|
||||
as in the example.
|
||||
</p>
|
||||
<p>
|
||||
The <a class="link" href="igraph-Basic.html#igraph_add_edges" title="5.3.2. igraph_add_edges — Adds edges to a graph object."><code class="function">igraph_add_edges()</code></a>
|
||||
function simply takes a graph and a vector of
|
||||
vertex IDs defining the new edges. The first edge is between the first
|
||||
two vertex IDs in the vector, the second edge is between the second
|
||||
two, etc. This way we add ten random edges to the lattice.
|
||||
</p>
|
||||
<p>
|
||||
Note that this example program may add <span class="emphasis"><em>loop edges</em></span>, edges
|
||||
pointing a vertex to itself, or <span class="emphasis"><em>multiple edges</em></span>, more than one edge
|
||||
between the same pair of vertices.
|
||||
<span class="type">igraph_t</span> can of course represent loops and multiple edges, although some
|
||||
routines expect simple graphs, i.e. graphs which contain neither of these. This is because some
|
||||
structural properties are ill-defined for non-simple graphs. Loop and multi-edges can be removed by calling
|
||||
<a class="link" href="igraph-Operators.html#igraph_simplify" title="3.11. igraph_simplify — Removes loop and/or multiple edges from the graph."><code class="function">igraph_simplify()</code></a>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="tut-lesson-3"></a>3. Calculating various properties of graphs</h2></div></div></div>
|
||||
<p>
|
||||
In our next example we will calculate various centrality measures in a
|
||||
friendship graph. The friendship graph is from the famous Zachary karate
|
||||
club study. (Do a web search on "Zachary karate" if you want to know more about
|
||||
this.) Centrality measures quantify how central is the position of
|
||||
individual vertices in the graph.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="strong"><strong>#include</strong></span> <igraph.h>
|
||||
|
||||
int <span class="strong"><strong>main</strong></span>(void) {
|
||||
igraph_t graph;
|
||||
igraph_vector_int_t result;
|
||||
<a class="link" href="igraph-Data-structures.html#igraph_vector_t" title="2.1. About igraph_vector_t objects">igraph_vector_t</a> result_real;
|
||||
igraph_int_t edges_array[] = {
|
||||
0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, 0,8,
|
||||
0,10, 0,11, 0,12, 0,13, 0,17, 0,19, 0,21, 0,31,
|
||||
1, 2, 1, 3, 1, 7, 1,13, 1,17, 1,19, 1,21, 1,30,
|
||||
2, 3, 2, 7, 2,27, 2,28, 2,32, 2, 9, 2, 8, 2,13,
|
||||
3, 7, 3,12, 3,13, 4, 6, 4,10, 5, 6, 5,10, 5,16,
|
||||
6,16, 8,30, 8,32, 8,33, 9,33, 13,33, 14,32, 14,33,
|
||||
15,32, 15,33, 18,32, 18,33, 19,33, 20,32, 20,33,
|
||||
22,32, 22,33, 23,25, 23,27, 23,32, 23,33, 23,29,
|
||||
24,25, 24,27, 24,31, 25,31, 26,29, 26,33, 27,33,
|
||||
28,31, 28,33, 29,32, 29,33, 30,32, 30,33, 31,32,
|
||||
31,33, 32,33
|
||||
};
|
||||
igraph_vector_int_t edges =
|
||||
<span class="strong"><strong>igraph_vector_int_view</strong></span>(edges_array, <span class="strong"><strong>sizeof</strong></span>(edges_array) / <span class="strong"><strong>sizeof</strong></span>(edges_array[0]));
|
||||
|
||||
<span class="emphasis"><em>/* Initialize the library. */</em></span>
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_setup" title="4.1. igraph_setup — Initializes the igraph library.">igraph_setup</a></strong></span>();
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Generators.html#igraph_create" title="2.1. igraph_create — Creates a graph with the specified edges.">igraph_create</a></strong></span>(&graph, &edges, 0, IGRAPH_UNDIRECTED);
|
||||
|
||||
<span class="strong"><strong>igraph_vector_int_init</strong></span>(&result, 0);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#igraph_vector_init" title="2.2.1. igraph_vector_init — Initializes a vector object (constructor).">igraph_vector_init</a></strong></span>(&result_real, 0);
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_degree" title="5.2.14. igraph_degree — The degree of some vertices in a graph.">igraph_degree</a></strong></span>(&graph, &result, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_all" title="4.1. igraph_vss_all — All vertices of a graph (immediate version).">igraph_vss_all</a></strong></span>(), IGRAPH_ALL, IGRAPH_LOOPS);
|
||||
<span class="strong"><strong>printf</strong></span>("Maximum degree is %10" IGRAPH_PRId ", vertex %2" IGRAPH_PRId ".\n",
|
||||
<span class="strong"><strong>igraph_vector_int_max</strong></span>(&result),
|
||||
<span class="strong"><strong>igraph_vector_int_which_max</strong></span>(&result));
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Structural.html#igraph_closeness" title="11.1. igraph_closeness — Closeness centrality calculations for some vertices.">igraph_closeness</a></strong></span>(&graph, &result_real, NULL, NULL, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_all" title="4.1. igraph_vss_all — All vertices of a graph (immediate version).">igraph_vss_all</a></strong></span>(),
|
||||
IGRAPH_ALL, <span class="emphasis"><em>/* weights= */</em></span> NULL, <span class="emphasis"><em>/* normalized= */</em></span> false);
|
||||
<span class="strong"><strong>printf</strong></span>("Maximum closeness is %10g, vertex %2" IGRAPH_PRId ".\n",
|
||||
(double) <span class="strong"><strong><a class="link" href="igraph-Data-structures.html#igraph_vector_max" title="2.10.2. igraph_vector_max — Largest element of a vector.">igraph_vector_max</a></strong></span>(&result_real),
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#igraph_vector_which_max" title="2.10.4. igraph_vector_which_max — Gives the index of the maximum element of the vector.">igraph_vector_which_max</a></strong></span>(&result_real));
|
||||
|
||||
<span class="strong"><strong><a class="link" href="igraph-Structural.html#igraph_betweenness" title="11.3. igraph_betweenness — Betweenness centrality of some vertices.">igraph_betweenness</a></strong></span>(&graph, <span class="emphasis"><em>/* weights= */</em></span> NULL, &result_real, <span class="strong"><strong><a class="link" href="igraph-Iterators.html#igraph_vss_all" title="4.1. igraph_vss_all — All vertices of a graph (immediate version).">igraph_vss_all</a></strong></span>(),
|
||||
IGRAPH_UNDIRECTED, <span class="emphasis"><em>/* normalized= */</em></span> false);
|
||||
<span class="strong"><strong>printf</strong></span>("Maximum betweenness is %10g, vertex %2" IGRAPH_PRId ".\n",
|
||||
(double) <span class="strong"><strong><a class="link" href="igraph-Data-structures.html#igraph_vector_max" title="2.10.2. igraph_vector_max — Largest element of a vector.">igraph_vector_max</a></strong></span>(&result_real),
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#igraph_vector_which_max" title="2.10.4. igraph_vector_which_max — Gives the index of the maximum element of the vector.">igraph_vector_which_max</a></strong></span>(&result_real));
|
||||
|
||||
<span class="strong"><strong>igraph_vector_int_destroy</strong></span>(&result);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Data-structures.html#igraph_vector_destroy" title="2.2.5. igraph_vector_destroy — Destroys a vector object.">igraph_vector_destroy</a></strong></span>(&result_real);
|
||||
<span class="strong"><strong><a class="link" href="igraph-Basic.html#igraph_destroy" title="5.1.4. igraph_destroy — Frees the memory allocated for a graph object.">igraph_destroy</a></strong></span>(&graph);
|
||||
|
||||
<span class="strong"><strong>return</strong></span> 0;
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
This example demonstrates some new operations. First of all, it shows a
|
||||
way to create a graph a list of edges stored in a plain C array.
|
||||
Function <a class="link" href="igraph-Data-structures.html#igraph_vector_view" title="2.5.1. igraph_vector_view — Handle a regular C array as a igraph_vector_t."><code class="function">igraph_vector_view()</code></a>
|
||||
creates a <span class="emphasis"><em>view</em></span> of a C array. It does not copy any data,
|
||||
which means that you must not call
|
||||
<a class="link" href="igraph-Data-structures.html#igraph_vector_destroy" title="2.2.5. igraph_vector_destroy — Destroys a vector object."><code class="function">igraph_vector_destroy()</code></a>
|
||||
on a vector created this way. This vector is then used to create the
|
||||
undirected graph.
|
||||
</p>
|
||||
<p>
|
||||
Then the degree, closeness and betweenness centrality of the vertices
|
||||
is calculated and the highest values are printed. Note that the vector
|
||||
<code class="varname">result</code>, into which these functions will write their
|
||||
result, must be initialized first, and also that the functions resize
|
||||
it to be able to hold the result.
|
||||
</p>
|
||||
<p>
|
||||
Notice that in order to print values of type <span class="type">igraph_int_t</span>,
|
||||
we used the <code class="constant">IGRAPH_PRId</code> format macro constant. This
|
||||
macro is similar to the standard <code class="constant">PRI</code> constants defined
|
||||
in <code class="code">stdint.h</code>, and expands to the correct <code class="code">printf</code>
|
||||
format specifier on each platform that <span class="command"><strong>igraph</strong></span> supports.
|
||||
</p>
|
||||
<p>
|
||||
The <a class="link" href="igraph-Iterators.html#igraph_vss_all" title="4.1. igraph_vss_all — All vertices of a graph (immediate version)."><code class="function">igraph_vss_all()</code></a> argument
|
||||
tells the functions to calculate the property for every vertex in the graph.
|
||||
It is shorthand for a <span class="emphasis"><em>vertex selector</em></span>, represented by type
|
||||
<span class="type">igraph_vs_t</span>.
|
||||
Vertex selectors help perform operations on a subset of vertices.
|
||||
You can read more about them in <a class="link" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">one
|
||||
of the following chapters</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"><a accesskey="p" href="igraph-Installation.html"><b>← Chapter 2. Installation</b></a></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Basic.html"><b>Chapter 4. Basic data types and interface →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,165 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>igraph Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="igraph Reference Manual">
|
||||
<link rel="next" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<script type="text/javascript" src="toggle.js"></script><link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
|
||||
<link rel="chapter" href="igraph-Introduction.html" title="Chapter 1. Introduction">
|
||||
<link rel="chapter" href="igraph-Installation.html" title="Chapter 2. Installation">
|
||||
<link rel="chapter" href="igraph-Tutorial.html" title="Chapter 3. Tutorial">
|
||||
<link rel="chapter" href="igraph-Basic.html" title="Chapter 4. Basic data types and interface">
|
||||
<link rel="chapter" href="igraph-Error.html" title="Chapter 5. Error handling">
|
||||
<link rel="chapter" href="igraph-Memory.html" title="Chapter 6. Memory (de)allocation">
|
||||
<link rel="chapter" href="igraph-Data-structures.html" title="Chapter 7. Data structure library: vector, matrix, other data types">
|
||||
<link rel="chapter" href="igraph-Random.html" title="Chapter 8. Random numbers">
|
||||
<link rel="chapter" href="igraph-Iterators.html" title="Chapter 9. Vertex and edge selectors and sequences, iterators">
|
||||
<link rel="chapter" href="igraph-Attributes.html" title="Chapter 10. Graph, vertex and edge attributes">
|
||||
<link rel="chapter" href="igraph-Generators.html" title="Chapter 11. Deterministic graph generators">
|
||||
<link rel="chapter" href="igraph-Games.html" title='Chapter 12. Stochastic graph generators ("games")'>
|
||||
<link rel="chapter" href="igraph-Bipartite.html" title="Chapter 13. Bipartite, i.e. two-mode graphs">
|
||||
<link rel="chapter" href="igraph-Spatial.html" title="Chapter 14. Spatial graphs">
|
||||
<link rel="chapter" href="igraph-Operators.html" title="Chapter 15. Graph operators">
|
||||
<link rel="chapter" href="igraph-Visitors.html" title="Chapter 16. Graph visitors">
|
||||
<link rel="chapter" href="igraph-Structural.html" title="Chapter 17. Structural properties of graphs">
|
||||
<link rel="chapter" href="igraph-Cycles.html" title="Chapter 18. Graph cycles">
|
||||
<link rel="chapter" href="igraph-Cliques.html" title="Chapter 19. Cliques and independent vertex sets">
|
||||
<link rel="chapter" href="igraph-Motifs.html" title="Chapter 20. Graph motifs, dyad census and triad census">
|
||||
<link rel="chapter" href="igraph-Isomorphism.html" title="Chapter 21. Graph isomorphism">
|
||||
<link rel="chapter" href="igraph-Coloring.html" title="Chapter 22. Graph coloring">
|
||||
<link rel="chapter" href="igraph-Flows.html" title="Chapter 23. Maximum flows, minimum cuts and related measures">
|
||||
<link rel="chapter" href="igraph-Separators.html" title="Chapter 24. Vertex separators">
|
||||
<link rel="chapter" href="igraph-Community.html" title="Chapter 25. Detecting community structure">
|
||||
<link rel="chapter" href="igraph-Graphlets.html" title="Chapter 26. Graphlets">
|
||||
<link rel="chapter" href="igraph-HRG.html" title="Chapter 27. Hierarchical random graphs">
|
||||
<link rel="chapter" href="igraph-Embedding.html" title="Chapter 28. Embedding of graphs">
|
||||
<link rel="chapter" href="igraph-Layout.html" title="Chapter 29. Generating layouts for graph drawing">
|
||||
<link rel="chapter" href="igraph-Processes.html" title="Chapter 30. Processes on graphs">
|
||||
<link rel="chapter" href="igraph-Foreign.html" title="Chapter 31. Reading and writing graphs from and to files">
|
||||
<link rel="chapter" href="igraph-Linalg.html" title="Chapter 32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs">
|
||||
<link rel="chapter" href="igraph-Nongraph.html" title="Chapter 33. Non-graph related functions">
|
||||
<link rel="chapter" href="igraph-Advanced.html" title="Chapter 34. Advanced igraph programming">
|
||||
<link rel="chapter" href="igraph-Glossary.html" title="Chapter 35. Glossary">
|
||||
<link rel="chapter" href="igraph-Licenses.html" title="Chapter 36. Licenses for igraph and this manual">
|
||||
<link rel="index" href="ix01.html" title="Index">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="book">
|
||||
<div class="titlepage">
|
||||
<div>
|
||||
<div></div>
|
||||
<div><div class="authorgroup">
|
||||
<div class="author">
|
||||
<h3 class="author">
|
||||
<span class="firstname">Gábor</span> <span class="surname">Csárdi</span>
|
||||
</h3>
|
||||
<div class="affiliation">
|
||||
<span class="orgname">Department of Statistics, Harvard University<br></span><div class="address"><p>1 Oxford street, Cambridge, MA, 02138 USA</p></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="author">
|
||||
<h3 class="author">
|
||||
<span class="firstname">Tamás</span> <span class="surname">Nepusz</span>
|
||||
</h3>
|
||||
<div class="affiliation">
|
||||
<span class="orgname">Department of Biological Physics, Eötvös Loránd University<br></span><div class="address"><p>1/a Pázmány Péter sétány, 1117 Budapest, Hungary</p></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="author">
|
||||
<h3 class="author">
|
||||
<span class="firstname">Vincent</span> <span class="surname">Traag</span>
|
||||
</h3>
|
||||
<div class="affiliation">
|
||||
<span class="orgname">Centre for Science and Technology Studies, Leiden University<br></span><div class="address"><p>Room B5.31, Kolffpad 1, 2333 BN Leiden, Netherlands</p></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="author">
|
||||
<h3 class="author">
|
||||
<span class="firstname">Szabolcs</span> <span class="surname">Horvát</span>
|
||||
</h3>
|
||||
<div class="affiliation">
|
||||
<span class="orgname">Department of Computer Science, Reykjavik University<br></span><div class="address"><p>Menntavegur 1, 102 Reykjavík, Iceland</p></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="author">
|
||||
<h3 class="author">
|
||||
<span class="firstname">Fabio</span> <span class="surname">Zanini</span>
|
||||
</h3>
|
||||
<div class="affiliation">
|
||||
<span class="orgname">Lowy Cancer Research Centre, University of New South Wales<br></span><div class="address"><p>Room 211, Botany and High St, Kensington, NSW, 2033, Australia</p></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="author">
|
||||
<h3 class="author">
|
||||
<span class="firstname">Daniel</span> <span class="surname">Noom</span>
|
||||
</h3>
|
||||
<div class="affiliation">
|
||||
<span class="orgname">jitjit software development<br></span><div class="address"><p>Amsterdam, Netherlands</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div></div>
|
||||
<div><p class="releaseinfo">1.0.1</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id-1.1.4"></a><p>This manual is for igraph, version 1.0.1.</p>
|
||||
<p>
|
||||
Copyright (C) 2005-2019 Gábor Csárdi and Tamás Nepusz.
|
||||
Copyright (C) 2020-2025 igraph development team.
|
||||
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
|
||||
<span class="quote">“<span class="quote">GNU Free Documentation License</span>”</span>.
|
||||
</p>
|
||||
</div></div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="chapter"><a href="igraph-Introduction.html">1. Introduction</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Installation.html">2. Installation</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Tutorial.html">3. Tutorial</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Basic.html">4. Basic data types and interface</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Error.html">5. Error handling</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Memory.html">6. Memory (de)allocation</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Data-structures.html">7. Data structure library: vector, matrix, other data types</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Random.html">8. Random numbers</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Iterators.html">9. Vertex and edge selectors and sequences, iterators</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Attributes.html">10. Graph, vertex and edge attributes</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Generators.html">11. Deterministic graph generators</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Games.html">12. Stochastic graph generators ("games")</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Bipartite.html">13. Bipartite, i.e. two-mode graphs</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Spatial.html">14. Spatial graphs</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Operators.html">15. Graph operators</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Visitors.html">16. Graph visitors</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Structural.html">17. Structural properties of graphs</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Cycles.html">18. Graph cycles</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Cliques.html">19. Cliques and independent vertex sets</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Motifs.html">20. Graph motifs, dyad census and triad census</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Isomorphism.html">21. Graph isomorphism</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Coloring.html">22. Graph coloring</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Flows.html">23. Maximum flows, minimum cuts and related measures</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Separators.html">24. Vertex separators</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Community.html">25. Detecting community structure</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Graphlets.html">26. Graphlets</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-HRG.html">27. Hierarchical random graphs</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Embedding.html">28. Embedding of graphs</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Layout.html">29. Generating layouts for graph drawing</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Processes.html">30. Processes on graphs</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Foreign.html">31. Reading and writing graphs from and to files</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Linalg.html">32. Using BLAS, LAPACK and ARPACK for igraph matrices and graphs</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Nongraph.html">33. Non-graph related functions </a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Advanced.html">34. Advanced igraph programming</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Glossary.html">35. Glossary</a></span></dt>
|
||||
<dt><span class="chapter"><a href="igraph-Licenses.html">36. Licenses for igraph and this manual</a></span></dt>
|
||||
<dt><span class="index"><a href="ix01.html">Index</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table class="navigation-footer" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
|
||||
<td align="left"></td>
|
||||
<td align="right"><a accesskey="n" href="igraph-Introduction.html"><b>Chapter 1. Introduction →</b></a></td>
|
||||
</tr></table>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 459 B |
Binary file not shown.
|
After Width: | Height: | Size: 472 B |
@@ -0,0 +1,279 @@
|
||||
.author { padding: 0px 30px 0pt; }
|
||||
.chapter { padding: 0px 20px 10px; }
|
||||
.section { padding: 0px 20px 10px; }
|
||||
.index { padding: 0px 20px 10px; }
|
||||
.legalnotice { padding: 0px 20px 10px; }
|
||||
.releaseinfo { padding: 0px 20px 10px; }
|
||||
.navigation-header { position: absolute; right: 20px; top: 7px; }
|
||||
.navigation-footer { padding: 0px 20px 10px; }
|
||||
.programlisting
|
||||
{
|
||||
background: #eeeeff;
|
||||
border: solid 1px #4444ff;
|
||||
padding: 0.5em;
|
||||
font-size: 16px;
|
||||
overflow: auto;
|
||||
}
|
||||
.constant, .literal {
|
||||
font-size: 16px;
|
||||
}
|
||||
.variablelist
|
||||
{
|
||||
padding: 4px;
|
||||
margin-left: 3em;
|
||||
}
|
||||
.variablelist td:first-child
|
||||
{
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
code
|
||||
{
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
table.navigation
|
||||
{
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
padding: 7px 0 7px 15px;
|
||||
text-shadow: 0px 1px 2px #000;
|
||||
background: #005fd7 url(header_blue.png) repeat-x;
|
||||
border-bottom: 1px solid #1c477f;
|
||||
font-size: large;
|
||||
}
|
||||
table.navigation a
|
||||
{
|
||||
color: #fff;
|
||||
}
|
||||
.navigation .title
|
||||
{
|
||||
font-size: 200%;
|
||||
}
|
||||
div.refnamediv
|
||||
{
|
||||
margin-top: 2em;
|
||||
}
|
||||
div.gallery-float
|
||||
{
|
||||
float: left;
|
||||
padding: 10px;
|
||||
}
|
||||
div.gallery-float img
|
||||
{
|
||||
border-style: none;
|
||||
}
|
||||
div.gallery-spacer
|
||||
{
|
||||
clear: both;
|
||||
}
|
||||
|
||||
body {
|
||||
font: medium/150% "Lucida Grande", sans-serif;
|
||||
margin: 0; padding: 0px 0px 10px;
|
||||
color: #333; background: #fff;
|
||||
}
|
||||
h1 {
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
padding: 7px 0 7px 15px;
|
||||
text-shadow: 0px 1px 2px #000;
|
||||
background: #005fd7 url(images/header_blue.png) repeat-x;
|
||||
border-bottom: 1px solid #1c477f;
|
||||
font-size: large;
|
||||
}
|
||||
.chapter h1 {
|
||||
/* compensate for main page horizontal padding */
|
||||
margin: 0 -20px;
|
||||
padding: 7px 20px 7px 35px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
h3 {
|
||||
font-size: 1em;
|
||||
}
|
||||
body.error h1 {
|
||||
background: #d70000;
|
||||
border-bottom: 1px solid #7f0000;
|
||||
}
|
||||
.main {
|
||||
padding: 7px 15px;
|
||||
}
|
||||
|
||||
ul.no-bullet {
|
||||
list-style-type: none;
|
||||
padding: 0; margin: 0;
|
||||
}
|
||||
ul.no-bullet li {
|
||||
padding: 0; margin: 0;
|
||||
}
|
||||
li.download {
|
||||
line-height: 1em;
|
||||
padding-bottom: 10px !important;
|
||||
}
|
||||
li.download .name {
|
||||
font-weight: bold;
|
||||
padding-left: 20px;
|
||||
}
|
||||
li.download .comment {
|
||||
font-size: 0.8em;
|
||||
color: #888;
|
||||
}
|
||||
li.download-c {
|
||||
background: url(images/icon_c.png) no-repeat 0px 0px;
|
||||
}
|
||||
li.download-r {
|
||||
background: url(images/icon_r.png) no-repeat 0px 0px;
|
||||
}
|
||||
li.download-python {
|
||||
background: url(images/icon_python.png) no-repeat 0px 0px;
|
||||
}
|
||||
li.download-ruby {
|
||||
background: url(images/icon_ruby.png) no-repeat 0px 0px;
|
||||
}
|
||||
ul.download-links {
|
||||
list-style-type: none;
|
||||
padding: 2px 0 0 20px; margin: 0;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
ul.download-links li {
|
||||
padding: 0px 10px 0px 0px; margin: 0;
|
||||
display: inline;
|
||||
padding-bottom: 5px !important;
|
||||
}
|
||||
ul.download-links li.download-source {
|
||||
background: url(images/icon_source.png) no-repeat 0px 0px;
|
||||
padding-left: 18px;
|
||||
}
|
||||
ul.download-links li.download-windows {
|
||||
background: url(images/icon_windows.png) no-repeat 0px 0px;
|
||||
padding-left: 18px;
|
||||
}
|
||||
ul.download-links li.download-debian {
|
||||
background: url(images/icon_debian.png) no-repeat 0px 0px;
|
||||
padding-left: 18px;
|
||||
}
|
||||
ul.download-links li.download-osx {
|
||||
background: url(images/icon_osx.png) no-repeat 0px 0px;
|
||||
padding-left: 18px;
|
||||
}
|
||||
ul.download-links li.download-external {
|
||||
background: url(images/icon_links.png) no-repeat 0px 0px;
|
||||
padding-left: 18px;
|
||||
}
|
||||
|
||||
a { color: #22d; text-decoration: none }
|
||||
a:visited { color: #219 }
|
||||
a:hover { color: #22d; text-decoration: underline; cursor: hand; }
|
||||
h1 a, h1 a:visited, h1 a:hover { color: #fff; text-decoration: none }
|
||||
h2 a, h2 a:visited, h2 a:hover { color: #000; text-decoration: none }
|
||||
h3 a, h3 a:visited, h3 a:hover { color: #000; text-decoration: none }
|
||||
|
||||
.navigation-header a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 4px 10px;
|
||||
text-shadow: 0 1px 2px #000;
|
||||
transition: background-color 300ms;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.navigation-header a:visited { color: white; text-decoration: none }
|
||||
.navigation-header a:hover { color: white; text-decoration: none; background-color: rgba(255, 255, 255, 0.3) }
|
||||
|
||||
span.type { font-family: monospace; font-size: 16px; }
|
||||
|
||||
/* Version info */
|
||||
#version_info {
|
||||
float: right;
|
||||
font-size: 0.8em;
|
||||
color: #888;
|
||||
padding: 3px 15px 0px 0px;
|
||||
}
|
||||
|
||||
/* Menu items */
|
||||
ul.menu {
|
||||
list-style-type: none;
|
||||
padding: 0; margin: 0;
|
||||
}
|
||||
ul.menu-upper {
|
||||
list-style-type: none;
|
||||
padding: 0px 0px 0px 15px; margin: 0;
|
||||
}
|
||||
|
||||
ul.menu li {
|
||||
padding: 0px 0px 10px 20px;
|
||||
margin: 0px;
|
||||
}
|
||||
ul.menu-upper li {
|
||||
padding: 3px 10px 10px 20px;
|
||||
font-size: 0.8em;
|
||||
margin: 0px;
|
||||
display: inline;
|
||||
}
|
||||
ul li.item-introduction {
|
||||
background: url(images/icon_introduction.png) no-repeat 0px 3px;
|
||||
}
|
||||
ul li.item-download {
|
||||
background: url(images/icon_download.png) no-repeat 0px 3px;
|
||||
}
|
||||
ul li.item-news {
|
||||
background: url(images/icon_news.png) no-repeat 0px 3px;
|
||||
}
|
||||
ul li.item-documentation {
|
||||
background: url(images/icon_documentation.png) no-repeat 0px 3px;
|
||||
}
|
||||
ul li.item-screenshots {
|
||||
background: url(images/icon_screenshots.png) no-repeat 0px 3px;
|
||||
}
|
||||
ul li.item-community {
|
||||
background: url(images/icon_community.png) no-repeat 0px 3px;
|
||||
}
|
||||
ul li.item-links {
|
||||
background: url(images/icon_links.png) no-repeat 0px 3px;
|
||||
}
|
||||
ul li.item-license {
|
||||
background: url(images/icon_license.png) no-repeat 0px 3px;
|
||||
}
|
||||
|
||||
/* Forms */
|
||||
label {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 130px;
|
||||
font-weight: bold;
|
||||
}
|
||||
label.normal {
|
||||
color: #444;
|
||||
}
|
||||
div.explanation {
|
||||
border-left: 130px solid white;
|
||||
font-size: 0.8em;
|
||||
color: #888;
|
||||
}
|
||||
div.example-contents {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.example p.title {
|
||||
color: blue;
|
||||
font-size:0.8em;
|
||||
}
|
||||
.example p.title b:before {
|
||||
content: '\25B6\00a0';
|
||||
}
|
||||
.example p.title:hover {
|
||||
color: #00f;
|
||||
text-decoration: underline;
|
||||
cursor: hand;
|
||||
}
|
||||
|
||||
.warning {
|
||||
background-color: #ffc;
|
||||
padding: 0.2em 1em;
|
||||
border: 1px solid #f80;
|
||||
}
|
||||
.warning .title {
|
||||
color: #f80;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
function getElementByClass(element, className) {
|
||||
tc = element.childNodes;
|
||||
for (var i = 0; i < tc.length; i++) {
|
||||
if (tc[i].className == className) { return tc[i]; }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function toggle(target, event) {
|
||||
exdiv = getElementByClass(target, "example");
|
||||
excdiv = getElementByClass(exdiv, "example-contents");
|
||||
titlediv = getElementByClass(exdiv, "title");
|
||||
|
||||
if (!titlediv || !titlediv.contains(event.target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (excdiv.style.display != 'block') {
|
||||
excdiv.style.display = 'block';
|
||||
} else {
|
||||
excdiv.style.display = 'none';
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 406 B |
Reference in New Issue
Block a user