igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Network Centralization Measure


From: Minh Nguyen
Subject: Re: [igraph] Network Centralization Measure
Date: Mon, 12 Sep 2011 00:57:50 +1000

Hi,

Please reply to the mailing list.

On Sun, Sep 11, 2011 at 11:14 PM, Carlos Eduardo <address@hidden> wrote:
> Hi Minh,
>
> Thanks for your answer. Allow me to ask a little bit more.
>
> I just begun my learning about how to use igraph and I am not familiarized
> with some command syntax.
>
> To the command "igraph_degree" is informed (igraph_degree(const igraph_t
> *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_neimode_t mode,
> igraph_bool_t loops).
>
> Being my graph name "g", in short I understood the syntax as follow:
> igraph_degree (g, res, vids, mode, loops).
>
> I don't know what to replace in the fields "res" and "vids".

I provide a small example below:

#include <igraph.h>
#include <stdio.h>

/* Obtain the degree of each vertex.
 */
int main() {
  igraph_t G;
  igraph_vector_t D;
  igraph_integer_t i;

  igraph_small(&G, /*n nodes*/ 0, IGRAPH_UNDIRECTED,
               0,1, 0,3, 0,4, 2,3, 2,4, -1);
  igraph_vector_init(&D, 0);
  igraph_degree(&G, &D, igraph_vss_all(), IGRAPH_ALL, IGRAPH_NO_LOOPS);
  for (i = 0; i < igraph_vector_size(&D); i++) {
    printf("Node %li has degree %li\n", (long int)i, (long int)VECTOR(D)[i]);
  }

  igraph_destroy(&G);
  igraph_vector_destroy(&D);

  return 0;
}


> I tried the follow simplified commands (but they didn't work):
>
> igraph_degree(g)
> igraph_degree(g, IGRAPH_ALL, FALSE)

You should be able to read lots of examples under the directory
examples/simple/.


> Ps.: The network I am trying this command follows attached (rda format).
>
> All the best,
> Cadu

-- 
Regards
Minh Van Nguyen

Attachment: g.rda
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]