~ubuntu-branches/ubuntu/wily/igraph/wily-proposed

« back to all changes in this revision

Viewing changes to examples/simple/igraph_is_separator.c.xml

  • Committer: Package Import Robot
  • Author(s): Tamás Nepusz, Andreas Tille, Tamas Nepusz
  • Date: 2014-08-29 08:39:02 UTC
  • mfrom: (7.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140829083902-y4k2iu2mlizkq0o0
Tags: 0.7.1-2
[ Andreas Tille ]
* Move packagiong from SVN to Git

[ Tamas Nepusz ]
* Remove debian/patches/link_f2c.patch; f2c linkage not needed if
  BLAS, LAPACK and ARPACK are all linked dynamically
  Closes: #702882
* debian/patches/remove_unused_test_target.patch added to make
  dh_auto_test work
* debian/patches/fix_failing_tests.patch added to fix some failing
  test cases 
* debian/patches/cppflags_restore.patch added to fix incorrect
  handling of CPPFLAGS in the configure script
* debian/patches/drl_spelling_fix.patch added to fix a spelling
  error in the source and silence a lintian warning

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<programlisting linenumbering="numbered"><emphasis>/* -*- mode: C -*-  */</emphasis>
2
 
<emphasis>/* </emphasis>
3
 
<emphasis>   IGraph library.</emphasis>
4
 
<emphasis>   Copyright (C) 2010-2012  Gabor Csardi </emphasis>&lt;csardi.gabor@gmail.com&gt;
5
 
<emphasis>   334 Harvard st, Cambridge MA, 02139 USA</emphasis>
6
 
<emphasis>   </emphasis>
7
 
<emphasis>   This program is free software; you can redistribute it and/or modify</emphasis>
8
 
<emphasis>   it under the terms of the GNU General Public License as published by</emphasis>
9
 
<emphasis>   the Free Software Foundation; either version 2 of the License, or</emphasis>
10
 
<emphasis>   (at your option) any later version.</emphasis>
11
 
<emphasis>   </emphasis>
12
 
<emphasis>   This program is distributed in the hope that it will be useful,</emphasis>
13
 
<emphasis>   but WITHOUT ANY WARRANTY; without even the implied warranty of</emphasis>
14
 
<emphasis>   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</emphasis>
15
 
<emphasis>   GNU General Public License for more details.</emphasis>
16
 
<emphasis>   </emphasis>
17
 
<emphasis>   You should have received a copy of the GNU General Public License</emphasis>
18
 
<emphasis>   along with this program; if not, write to the Free Software</emphasis>
19
 
<emphasis>   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA </emphasis>
20
 
<emphasis>   02110-1301 USA</emphasis>
21
 
 
22
 
<emphasis>*/</emphasis>
23
 
 
24
 
<emphasis role="strong">#include</emphasis> &lt;igraph.h&gt;
25
 
<emphasis role="strong">#include</emphasis> &lt;stdio.h&gt;
26
 
 
27
 
<emphasis role="strong">#define</emphasis> <emphasis role="strong">FAIL</emphasis>(msg, error) <emphasis role="strong">do</emphasis> { <emphasis role="strong">printf</emphasis>(msg "\n") ; <emphasis role="strong">return</emphasis> error; } <emphasis role="strong">while</emphasis> (0)
28
 
 
29
 
int <emphasis role="strong">main</emphasis>() {
30
 
  
31
 
  igraph_t graph;
32
 
  <link linkend='igraph_vector_t'>igraph_vector_t</link> sep;
33
 
  igraph_bool_t result;
34
 
 
35
 
  <emphasis>/* Simple star graph, remove the center */</emphasis>
36
 
  <emphasis role="strong"><link linkend='igraph_star'>igraph_star</link></emphasis>(&amp;graph, 10, IGRAPH_STAR_UNDIRECTED, 0);
37
 
  <emphasis role="strong"><link linkend='igraph_is_separator'>igraph_is_separator</link></emphasis>(&amp;graph, <emphasis role="strong"><link linkend='igraph_vss_1'>igraph_vss_1</link></emphasis>(0), &amp;result);
38
 
  <emphasis role="strong">if</emphasis> (!result) <emphasis role="strong">FAIL</emphasis>("Center of star graph failed.", 1);
39
 
 
40
 
  <emphasis>/* Same graph, but another vertex */</emphasis>
41
 
  <emphasis role="strong"><link linkend='igraph_is_separator'>igraph_is_separator</link></emphasis>(&amp;graph, <emphasis role="strong"><link linkend='igraph_vss_1'>igraph_vss_1</link></emphasis>(6), &amp;result);
42
 
  <emphasis role="strong">if</emphasis> (result) <emphasis role="strong">FAIL</emphasis>("Non-center of star graph failed.", 2);
43
 
  <emphasis role="strong"><link linkend='igraph_destroy'>igraph_destroy</link></emphasis>(&amp;graph);
44
 
 
45
 
  <emphasis>/* Karate club */</emphasis>
46
 
  <emphasis role="strong"><link linkend='igraph_famous'>igraph_famous</link></emphasis>(&amp;graph, "zachary");
47
 
  <emphasis role="strong"><link linkend='igraph_vector_init'>igraph_vector_init</link></emphasis>(&amp;sep, 0);
48
 
  <emphasis role="strong"><link linkend='igraph_vector_push_back'>igraph_vector_push_back</link></emphasis>(&amp;sep, 32);
49
 
  <emphasis role="strong"><link linkend='igraph_vector_push_back'>igraph_vector_push_back</link></emphasis>(&amp;sep, 33);
50
 
  <emphasis role="strong"><link linkend='igraph_is_separator'>igraph_is_separator</link></emphasis>(&amp;graph, <emphasis role="strong"><link linkend='igraph_vss_vector'>igraph_vss_vector</link></emphasis>(&amp;sep), &amp;result);
51
 
  <emphasis role="strong">if</emphasis> (!result) <emphasis role="strong">FAIL</emphasis>("Karate network (32,33) failed", 3);
52
 
 
53
 
  <emphasis role="strong"><link linkend='igraph_vector_resize'>igraph_vector_resize</link></emphasis>(&amp;sep, 5);
54
 
  <emphasis role="strong"><link linkend='VECTOR'>VECTOR</link></emphasis>(sep)[0]=8;
55
 
  <emphasis role="strong"><link linkend='VECTOR'>VECTOR</link></emphasis>(sep)[1]=9;
56
 
  <emphasis role="strong"><link linkend='VECTOR'>VECTOR</link></emphasis>(sep)[2]=19;
57
 
  <emphasis role="strong"><link linkend='VECTOR'>VECTOR</link></emphasis>(sep)[3]=30;
58
 
  <emphasis role="strong"><link linkend='VECTOR'>VECTOR</link></emphasis>(sep)[4]=31;
59
 
  <emphasis role="strong"><link linkend='igraph_is_separator'>igraph_is_separator</link></emphasis>(&amp;graph, <emphasis role="strong"><link linkend='igraph_vss_vector'>igraph_vss_vector</link></emphasis>(&amp;sep), &amp;result);
60
 
  <emphasis role="strong">if</emphasis> (result) <emphasis role="strong">FAIL</emphasis>("Karate network (8,9,19,30,31) failed", 4);
61
 
 
62
 
  <emphasis role="strong"><link linkend='igraph_destroy'>igraph_destroy</link></emphasis>(&amp;graph);
63
 
  <emphasis role="strong"><link linkend='igraph_vector_destroy'>igraph_vector_destroy</link></emphasis>(&amp;sep);
64
 
 
65
 
  <emphasis role="strong">return</emphasis> 0;
66
 
}
67
 
 
68
 
</programlisting>